diff options
author | doko@ubuntu.com <doko@ubuntu.com> | 2013-03-19 21:50:38 (GMT) |
---|---|---|
committer | doko@ubuntu.com <doko@ubuntu.com> | 2013-03-19 21:50:38 (GMT) |
commit | 71610752d6b2ee8b6a80a99b1e9f0a2bbc83b2f0 (patch) | |
tree | 75a32be2f060d3e7847d0babdc3279e53d270c30 /Lib | |
parent | 4950a3b6ccb91e0ffe937374836caa825e93c742 (diff) | |
download | cpython-71610752d6b2ee8b6a80a99b1e9f0a2bbc83b2f0.zip cpython-71610752d6b2ee8b6a80a99b1e9f0a2bbc83b2f0.tar.gz cpython-71610752d6b2ee8b6a80a99b1e9f0a2bbc83b2f0.tar.bz2 |
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.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/bsddb/test/test_basics.py | 14 | ||||
-rw-r--r-- | Lib/bsddb/test/test_db.py | 102 | ||||
-rw-r--r-- | Lib/bsddb/test/test_distributed_transactions.py | 10 |
3 files changed, 63 insertions, 63 deletions
diff --git a/Lib/bsddb/test/test_basics.py b/Lib/bsddb/test/test_basics.py index 8c44503..3c57be4 100644 --- a/Lib/bsddb/test/test_basics.py +++ b/Lib/bsddb/test/test_basics.py @@ -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, diff --git a/Lib/bsddb/test/test_db.py b/Lib/bsddb/test/test_db.py index 98705fe..2bc109f 100644 --- a/Lib/bsddb/test/test_db.py +++ b/Lib/bsddb/test/test_db.py @@ -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_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()) - - # 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) + 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_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) 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_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_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_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_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_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_suite(): suite = unittest.TestSuite() diff --git a/Lib/bsddb/test/test_distributed_transactions.py b/Lib/bsddb/test/test_distributed_transactions.py index 3466d7a..9058575 100644 --- a/Lib/bsddb/test/test_distributed_transactions.py +++ b/Lib/bsddb/test/test_distributed_transactions.py @@ -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() |