summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGregory P. Smith <greg@mad-scientist.com>2005-06-06 18:12:24 (GMT)
committerGregory P. Smith <greg@mad-scientist.com>2005-06-06 18:12:24 (GMT)
commit7e87a8a0be621c8fc09f44c2047b44d63ddba8f8 (patch)
tree497cf60cdfd71bcc0afba007062eb1806131a450
parentc9321ccdfc51bc5e6317151467eb008720a86fe7 (diff)
downloadcpython-7e87a8a0be621c8fc09f44c2047b44d63ddba8f8.zip
cpython-7e87a8a0be621c8fc09f44c2047b44d63ddba8f8.tar.gz
cpython-7e87a8a0be621c8fc09f44c2047b44d63ddba8f8.tar.bz2
fix more Errors (not Failures) when run using BerkeleyDB <= 4.0
-rw-r--r--Lib/bsddb/test/test_associate.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/Lib/bsddb/test/test_associate.py b/Lib/bsddb/test/test_associate.py
index 541af51..b83b65f 100644
--- a/Lib/bsddb/test/test_associate.py
+++ b/Lib/bsddb/test/test_associate.py
@@ -127,7 +127,8 @@ class AssociateErrorTestCase(unittest.TestCase):
# dupDB has been configured to allow duplicates, it can't
# associate with a secondary. BerkeleyDB will return an error.
try:
- dupDB.associate(secDB, lambda a, b: a+b)
+ def f(a,b): return a+b
+ dupDB.associate(secDB, f)
except db.DBError:
# good
secDB.close()
@@ -181,8 +182,12 @@ class AssociateTestCase(unittest.TestCase):
self.secDB = None
self.primary = db.DB(self.env)
self.primary.set_get_returns_none(2)
- self.primary.open(self.filename, "primary", self.dbtype,
+ if db.version() >= (4, 1):
+ self.primary.open(self.filename, "primary", self.dbtype,
db.DB_CREATE | db.DB_THREAD | self.dbFlags, txn=txn)
+ else:
+ self.primary.open(self.filename, "primary", self.dbtype,
+ db.DB_CREATE | db.DB_THREAD | self.dbFlags)
def closeDB(self):
if self.cur:
@@ -346,7 +351,10 @@ class AssociateBTreeTxnTestCase(AssociateBTreeTestCase):
self.secDB.set_get_returns_none(2)
self.secDB.open(self.filename, "secondary", db.DB_BTREE,
db.DB_CREATE | db.DB_THREAD, txn=txn)
- self.getDB().associate(self.secDB, self.getGenre, txn=txn)
+ if db.version() >= (4,1):
+ self.getDB().associate(self.secDB, self.getGenre, txn=txn)
+ else:
+ self.getDB().associate(self.secDB, self.getGenre)
self.addDataToDB(self.getDB(), txn=txn)
except:
@@ -446,7 +454,8 @@ def test_suite():
suite.addTest(unittest.makeSuite(AssociateBTreeTestCase))
suite.addTest(unittest.makeSuite(AssociateRecnoTestCase))
- suite.addTest(unittest.makeSuite(AssociateBTreeTxnTestCase))
+ if db.version() >= (4, 1):
+ suite.addTest(unittest.makeSuite(AssociateBTreeTxnTestCase))
suite.addTest(unittest.makeSuite(ShelveAssociateHashTestCase))
suite.addTest(unittest.makeSuite(ShelveAssociateBTreeTestCase))