darylm503 4710c53dca AppPkg/Applications/Python: Add Python 2.7.2 sources since the release of Python 2.7.3 made them unavailable from the python.org web site.
These files are a subset of the python-2.7.2.tgz distribution from python.org.  Changed files from PyMod-2.7.2 have been copied into the corresponding directories of this tree, replacing the original files in the distribution.

Signed-off-by: daryl.mcdaniel@intel.com


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13197 6f19259b-4bc3-4df7-8a09-765794883524
2012-04-16 22:12:42 +00:00

44 lines
1.3 KiB
Python

"""Tests for the bsddb185 module.
The file 185test.db found in Lib/test/ is for testing purposes with this
testing suite.
"""
from test.test_support import run_unittest, findfile, import_module
import unittest
bsddb185 = import_module('bsddb185', deprecated=True)
import anydbm
import whichdb
import os
import tempfile
import shutil
class Bsddb185Tests(unittest.TestCase):
def test_open_existing_hash(self):
# Verify we can open a file known to be a hash v2 file
db = bsddb185.hashopen(findfile("185test.db"))
self.assertEqual(db["1"], "1")
db.close()
def test_whichdb(self):
# Verify that whichdb correctly sniffs the known hash v2 file
self.assertEqual(whichdb.whichdb(findfile("185test.db")), "bsddb185")
def test_anydbm_create(self):
# Verify that anydbm.open does *not* create a bsddb185 file
tmpdir = tempfile.mkdtemp()
try:
dbfile = os.path.join(tmpdir, "foo.db")
anydbm.open(dbfile, "c").close()
ftype = whichdb.whichdb(dbfile)
self.assertNotEqual(ftype, "bsddb185")
finally:
shutil.rmtree(tmpdir)
def test_main():
run_unittest(Bsddb185Tests)
if __name__ == "__main__":
test_main()