def test_unicode(self): _, env = testlib.temp_env() assert env.open_db(B('myindex')) is not None self.assertRaises(TypeError, lambda: env.open_db(UnicodeType('myindex')))
import sys import unittest import weakref import testlib from testlib import B from testlib import OCT from testlib import INT_TYPES from testlib import UnicodeType import lmdb # Whether we have the patch that allows env.copy* to take a txn have_txn_patch = lmdb.version(subpatch=True)[3] NO_READERS = UnicodeType('(no active readers)\n') try: PAGE_SIZE = os.sysconf(os.sysconf_names['SC_PAGE_SIZE']) except (AttributeError, KeyError, OSError): PAGE_SIZE = 4096 class VersionTest(unittest.TestCase): def tearDown(self): testlib.cleanup() def test_version(self): ver = lmdb.version() assert len(ver) == 3 assert all(isinstance(i, INT_TYPES) for i in ver)