[Python-checkins]
python/dist/src/Lib/bsddb/test test_basics.py, 1.7,
1.7.6.1 test_compat.py, 1.5, 1.5.6.1
greg at users.sourceforge.net
greg at users.sourceforge.net
Thu Feb 26 05:21:24 EST 2004
Update of /cvsroot/python/python/dist/src/Lib/bsddb/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21983/Lib/bsddb/test
Modified Files:
Tag: release23-maint
test_basics.py test_compat.py
Log Message:
Fixes SF bsddb module bug 788421:
* Fixed a bug in the compatibility interface set_location() method
where it would not properly search to the next nearest key when
used on BTree databases. [SF bug id 788421]
* Fixed a bug in the compatibility interface set_location() method
where it could crash when looking up keys in a hash or recno
format database due to an incorrect free().
Index: test_basics.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/test/test_basics.py,v
retrieving revision 1.7
retrieving revision 1.7.6.1
diff -C2 -d -r1.7 -r1.7.6.1
*** test_basics.py 9 Jul 2003 04:45:59 -0000 1.7
--- test_basics.py 26 Feb 2004 10:21:13 -0000 1.7.6.1
***************
*** 371,375 ****
if verbose:
print "searched (partial) for '011', found: ", rec
! if rec[1] != '': set.fail('expected empty data portion')
c.set('0499')
--- 371,380 ----
if verbose:
print "searched (partial) for '011', found: ", rec
! if rec[1] != '': self.fail('expected empty data portion')
!
! ev = c.set_range('empty value')
! if verbose:
! print "search for 'empty value' returned", ev
! if ev[1] != '': self.fail('empty value lookup failed')
c.set('0499')
Index: test_compat.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/test/test_compat.py,v
retrieving revision 1.5
retrieving revision 1.5.6.1
diff -C2 -d -r1.5 -r1.5.6.1
*** test_compat.py 9 Jul 2003 05:29:24 -0000 1.5
--- test_compat.py 26 Feb 2004 10:21:13 -0000 1.5.6.1
***************
*** 50,53 ****
--- 50,57 ----
assert getTest[1] == 'quick', 'data mismatch!'
+ rv = f.set_location(3)
+ if rv != (3, 'brown'):
+ self.fail('recno database set_location failed: '+repr(rv))
+
f[25] = 'twenty-five'
f.close()
***************
*** 84,88 ****
-
def do_bthash_test(self, factory, what):
if verbose:
--- 88,91 ----
***************
*** 104,107 ****
--- 107,111 ----
f['c'] = 'Rossum'
f['d'] = 'invented'
+ # 'e' intentionally left out
f['f'] = 'Python'
if verbose:
***************
*** 110,114 ****
if verbose:
print 'key ordering...'
! f.set_location(f.first()[0])
while 1:
try:
--- 114,120 ----
if verbose:
print 'key ordering...'
! start = f.set_location(f.first()[0])
! if start != ('0', ''):
! self.fail("incorrect first() result: "+repr(start))
while 1:
try:
***************
*** 123,126 ****
--- 129,146 ----
assert f.has_key('f'), 'Error, missing key!'
+ # test that set_location() returns the next nearest key, value
+ # on btree databases and raises KeyError on others.
+ if factory == btopen:
+ e = f.set_location('e')
+ if e != ('f', 'Python'):
+ self.fail('wrong key,value returned: '+repr(e))
+ else:
+ try:
+ e = f.set_location('e')
+ except KeyError:
+ pass
+ else:
+ self.fail("set_location on non-existant key did not raise KeyError")
+
f.sync()
f.close()
More information about the Python-checkins
mailing list