Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
13a5678a
Kaydet (Commit)
13a5678a
authored
Agu 02, 2002
tarafından
Skip Montanaro
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
regression test for the whichdb module
üst
37c3b278
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
0 deletions
+63
-0
test_whichdb.py
Lib/test/test_whichdb.py
+63
-0
No files found.
Lib/test/test_whichdb.py
0 → 100644
Dosyayı görüntüle @
13a5678a
#! /usr/bin/env python
"""Test script for the whichdb module
based on test_anydbm.py
"""
import
os
import
test.test_support
import
unittest
import
whichdb
import
anydbm
import
tempfile
import
glob
_fname
=
tempfile
.
mktemp
()
def
_delete_files
():
# we don't know the precise name the underlying database uses
# so we use glob to locate all names
for
f
in
glob
.
glob
(
_fname
+
"*"
):
try
:
os
.
unlink
(
f
)
except
OSError
:
pass
class
WhichDBTestCase
(
unittest
.
TestCase
):
# Actual test methods are added to namespace
# after class definition.
def
__init__
(
self
,
*
args
):
unittest
.
TestCase
.
__init__
(
self
,
*
args
)
def
tearDown
(
self
):
_delete_files
()
def
setUp
(
self
):
_delete_files
()
for
name
in
anydbm
.
_names
:
# we define a new test method for each
# candidate database module.
try
:
mod
=
__import__
(
name
)
except
ImportError
:
continue
def
test_whichdb_name
(
self
,
name
=
name
,
mod
=
mod
):
"""Check whether whichdb correctly guesses module name
for databases opened with module mod.
"""
f
=
mod
.
open
(
_fname
,
'c'
)
f
[
"1"
]
=
"1"
f
.
close
()
self
.
assertEqual
(
name
,
whichdb
.
whichdb
(
_fname
))
setattr
(
WhichDBTestCase
,
"test_whichdb_
%
s"
%
name
,
test_whichdb_name
)
def
test_main
():
try
:
test
.
test_support
.
run_unittest
(
WhichDBTestCase
)
finally
:
_delete_files
()
if
__name__
==
"__main__"
:
test_main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment