summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_whichdb.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-05-26 10:29:35 (GMT)
committerGeorg Brandl <georg@python.org>2008-05-26 10:29:35 (GMT)
commit0a7ac7d70d370544c6a9d118bbbd6886ad4f5ce5 (patch)
treeec61fd6d53e6425b8639567860140c724ea7bc63 /Lib/test/test_whichdb.py
parente6f00637be87c8f5f0e50bf317d684ea421a6d19 (diff)
downloadcpython-0a7ac7d70d370544c6a9d118bbbd6886ad4f5ce5.zip
cpython-0a7ac7d70d370544c6a9d118bbbd6886ad4f5ce5.tar.gz
cpython-0a7ac7d70d370544c6a9d118bbbd6886ad4f5ce5.tar.bz2
Create the dbm package from PEP 3108. #2881.
Diffstat (limited to 'Lib/test/test_whichdb.py')
-rw-r--r--Lib/test/test_whichdb.py58
1 files changed, 0 insertions, 58 deletions
diff --git a/Lib/test/test_whichdb.py b/Lib/test/test_whichdb.py
deleted file mode 100644
index d908ac5..0000000
--- a/Lib/test/test_whichdb.py
+++ /dev/null
@@ -1,58 +0,0 @@
-#! /usr/bin/env python
-"""Test script for the whichdb module
- based on test_anydbm.py
-"""
-
-import os
-import test.support
-import unittest
-import whichdb
-import anydbm
-import glob
-from test.test_anydbm import delete_files, dbm_iterator
-
-_fname = test.support.TESTFN
-
-class WhichDBTestCase(unittest.TestCase):
- # Actual test methods are added to namespace
- # after class definition.
- def __init__(self, *args):
- unittest.TestCase.__init__(self, *args)
-
- def test_whichdb(self):
- for module in dbm_iterator():
- # Check whether whichdb correctly guesses module name
- # for databases opened with "module" module.
- # Try with empty files first
- name = module.__name__
- if name == 'dumbdbm':
- continue # whichdb can't support dumbdbm
- test.support.unlink(_fname)
- f = module.open(_fname, 'c')
- f.close()
- self.assertEqual(name, whichdb.whichdb(_fname))
- # Now add a key
- f = module.open(_fname, 'w')
- f[b"1"] = b"1"
- # and test that we can find it
- self.assertTrue(b"1" in f)
- # and read it
- self.assertTrue(f[b"1"] == b"1")
- f.close()
- self.assertEqual(name, whichdb.whichdb(_fname))
-
- def tearDown(self):
- delete_files()
-
- def setUp(self):
- delete_files()
-
-
-def test_main():
- try:
- test.support.run_unittest(WhichDBTestCase)
- finally:
- delete_files()
-
-if __name__ == "__main__":
- test_main()