mirror of https://github.com/python/cpython
Reindent files for:
- Issue #17477: Update the bsddb module to pybsddb 5.3.0, supporting db-5.x, and dropping support for db-4.1 and db-4.2.
This commit is contained in:
parent
4950a3b6cc
commit
71610752d6
|
@ -68,13 +68,13 @@ class BasicTestCase(unittest.TestCase):
|
|||
# create and open the DB
|
||||
self.d = db.DB(self.env)
|
||||
if not self.useEnv :
|
||||
self.d.set_cachesize(*self.cachesize)
|
||||
cachesize = self.d.get_cachesize()
|
||||
self.assertEqual(cachesize[0], self.cachesize[0])
|
||||
self.assertEqual(cachesize[2], self.cachesize[2])
|
||||
# Berkeley DB expands the cache 25% accounting overhead,
|
||||
# if the cache is small.
|
||||
self.assertEqual(125, int(100.0*cachesize[1]/self.cachesize[1]))
|
||||
self.d.set_cachesize(*self.cachesize)
|
||||
cachesize = self.d.get_cachesize()
|
||||
self.assertEqual(cachesize[0], self.cachesize[0])
|
||||
self.assertEqual(cachesize[2], self.cachesize[2])
|
||||
# Berkeley DB expands the cache 25% accounting overhead,
|
||||
# if the cache is small.
|
||||
self.assertEqual(125, int(100.0*cachesize[1]/self.cachesize[1]))
|
||||
self.d.set_flags(self.dbsetflags)
|
||||
if self.dbname:
|
||||
self.d.open(self.filename, self.dbname, self.dbtype,
|
||||
|
|
|
@ -63,28 +63,28 @@ class DB_general(DB) :
|
|||
self.assertFalse(self.db.get_transactional())
|
||||
|
||||
class DB_hash(DB) :
|
||||
def test_h_ffactor(self) :
|
||||
for ffactor in [4, 16, 256] :
|
||||
self.db.set_h_ffactor(ffactor)
|
||||
self.assertEqual(ffactor, self.db.get_h_ffactor())
|
||||
def test_h_ffactor(self) :
|
||||
for ffactor in [4, 16, 256] :
|
||||
self.db.set_h_ffactor(ffactor)
|
||||
self.assertEqual(ffactor, self.db.get_h_ffactor())
|
||||
|
||||
def test_h_nelem(self) :
|
||||
for nelem in [1, 2, 4] :
|
||||
nelem = nelem*1024*1024 # Millions
|
||||
self.db.set_h_nelem(nelem)
|
||||
self.assertEqual(nelem, self.db.get_h_nelem())
|
||||
def test_h_nelem(self) :
|
||||
for nelem in [1, 2, 4] :
|
||||
nelem = nelem*1024*1024 # Millions
|
||||
self.db.set_h_nelem(nelem)
|
||||
self.assertEqual(nelem, self.db.get_h_nelem())
|
||||
|
||||
def test_pagesize(self) :
|
||||
for i in xrange(9, 17) : # From 512 to 65536
|
||||
i = 1<<i
|
||||
self.db.set_pagesize(i)
|
||||
self.assertEqual(i, self.db.get_pagesize())
|
||||
def test_pagesize(self) :
|
||||
for i in xrange(9, 17) : # From 512 to 65536
|
||||
i = 1<<i
|
||||
self.db.set_pagesize(i)
|
||||
self.assertEqual(i, self.db.get_pagesize())
|
||||
|
||||
# The valid values goes from 512 to 65536
|
||||
# Test 131072 bytes...
|
||||
self.assertRaises(db.DBInvalidArgError, self.db.set_pagesize, 1<<17)
|
||||
# Test 256 bytes...
|
||||
self.assertRaises(db.DBInvalidArgError, self.db.set_pagesize, 1<<8)
|
||||
# The valid values goes from 512 to 65536
|
||||
# Test 131072 bytes...
|
||||
self.assertRaises(db.DBInvalidArgError, self.db.set_pagesize, 1<<17)
|
||||
# Test 256 bytes...
|
||||
self.assertRaises(db.DBInvalidArgError, self.db.set_pagesize, 1<<8)
|
||||
|
||||
class DB_txn(DB) :
|
||||
def setUp(self) :
|
||||
|
@ -116,37 +116,37 @@ class DB_txn(DB) :
|
|||
self.assertTrue(self.db.get_transactional())
|
||||
|
||||
class DB_recno(DB) :
|
||||
def test_re_pad(self) :
|
||||
for i in [' ', '*'] : # Check chars
|
||||
self.db.set_re_pad(i)
|
||||
self.assertEqual(ord(i), self.db.get_re_pad())
|
||||
for i in [97, 65] : # Check integers
|
||||
self.db.set_re_pad(i)
|
||||
self.assertEqual(i, self.db.get_re_pad())
|
||||
def test_re_pad(self) :
|
||||
for i in [' ', '*'] : # Check chars
|
||||
self.db.set_re_pad(i)
|
||||
self.assertEqual(ord(i), self.db.get_re_pad())
|
||||
for i in [97, 65] : # Check integers
|
||||
self.db.set_re_pad(i)
|
||||
self.assertEqual(i, self.db.get_re_pad())
|
||||
|
||||
def test_re_delim(self) :
|
||||
for i in [' ', '*'] : # Check chars
|
||||
self.db.set_re_delim(i)
|
||||
self.assertEqual(ord(i), self.db.get_re_delim())
|
||||
for i in [97, 65] : # Check integers
|
||||
self.db.set_re_delim(i)
|
||||
self.assertEqual(i, self.db.get_re_delim())
|
||||
def test_re_delim(self) :
|
||||
for i in [' ', '*'] : # Check chars
|
||||
self.db.set_re_delim(i)
|
||||
self.assertEqual(ord(i), self.db.get_re_delim())
|
||||
for i in [97, 65] : # Check integers
|
||||
self.db.set_re_delim(i)
|
||||
self.assertEqual(i, self.db.get_re_delim())
|
||||
|
||||
def test_re_source(self) :
|
||||
for i in ["test", "test2", "test3"] :
|
||||
self.db.set_re_source(i)
|
||||
self.assertEqual(i, self.db.get_re_source())
|
||||
def test_re_source(self) :
|
||||
for i in ["test", "test2", "test3"] :
|
||||
self.db.set_re_source(i)
|
||||
self.assertEqual(i, self.db.get_re_source())
|
||||
|
||||
class DB_queue(DB) :
|
||||
def test_re_len(self) :
|
||||
for i in [33, 65, 300, 2000] :
|
||||
self.db.set_re_len(i)
|
||||
self.assertEqual(i, self.db.get_re_len())
|
||||
def test_re_len(self) :
|
||||
for i in [33, 65, 300, 2000] :
|
||||
self.db.set_re_len(i)
|
||||
self.assertEqual(i, self.db.get_re_len())
|
||||
|
||||
def test_q_extentsize(self) :
|
||||
for i in [1, 60, 100] :
|
||||
self.db.set_q_extentsize(i)
|
||||
self.assertEqual(i, self.db.get_q_extentsize())
|
||||
def test_q_extentsize(self) :
|
||||
for i in [1, 60, 100] :
|
||||
self.db.set_q_extentsize(i)
|
||||
self.assertEqual(i, self.db.get_q_extentsize())
|
||||
|
||||
def test_suite():
|
||||
suite = unittest.TestSuite()
|
||||
|
|
|
@ -30,11 +30,11 @@ class DBTxn_distributed(unittest.TestCase):
|
|||
self.db = db.DB(self.dbenv)
|
||||
self.db.set_re_len(db.DB_GID_SIZE)
|
||||
if must_open_db :
|
||||
txn=self.dbenv.txn_begin()
|
||||
self.db.open(self.filename,
|
||||
db.DB_QUEUE, db.DB_CREATE | db.DB_THREAD, 0666,
|
||||
txn=txn)
|
||||
txn.commit()
|
||||
txn=self.dbenv.txn_begin()
|
||||
self.db.open(self.filename,
|
||||
db.DB_QUEUE, db.DB_CREATE | db.DB_THREAD, 0666,
|
||||
txn=txn)
|
||||
txn.commit()
|
||||
|
||||
def setUp(self) :
|
||||
self.homeDir = get_new_environment_path()
|
||||
|
|
Loading…
Reference in New Issue