summaryrefslogtreecommitdiff
path: root/python/test
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2002-06-07 13:12:34 +0000
committerjbj <devnull@localhost>2002-06-07 13:12:34 +0000
commit128357ffba2916f1e5e322a28361b8eaa9a5b494 (patch)
tree499a3368bb7ad85af46667b11c9ec78579b68810 /python/test
parent8d1ff9feac92bae03417280eebae5c19a1e7661a (diff)
downloadlibrpm-tizen-128357ffba2916f1e5e322a28361b8eaa9a5b494.tar.gz
librpm-tizen-128357ffba2916f1e5e322a28361b8eaa9a5b494.tar.bz2
librpm-tizen-128357ffba2916f1e5e322a28361b8eaa9a5b494.zip
Changes from bsddb3-3.3.4.
CVS patchset: 5471 CVS date: 2002/06/07 13:12:34
Diffstat (limited to 'python/test')
-rw-r--r--python/test/test_basics.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/python/test/test_basics.py b/python/test/test_basics.py
index 1b62bd825..028f56cd8 100644
--- a/python/test/test_basics.py
+++ b/python/test/test_basics.py
@@ -322,6 +322,11 @@ class BasicTestCase(unittest.TestCase):
if verbose:
print "searched for '011', found: ", rec
+ rec = c.set_range('011',dlen=0,doff=0)
+ if verbose:
+ print "searched (partial) for '011', found: ", rec
+ if rec[1] != '': set.fail('expected empty data portion')
+
c.set('0499')
c.delete()
try:
@@ -340,6 +345,9 @@ class BasicTestCase(unittest.TestCase):
assert c.current() == c2.current()
assert c.current()[1] == 'a new value'
+ c2.put('', 'er', db.DB_CURRENT, dlen=0, doff=5)
+ assert c2.current()[1] == 'a newer value'
+
c.close()
c2.close()
@@ -412,6 +420,20 @@ class BasicTestCase(unittest.TestCase):
assert d.get_size(key) == i
#print "done"
+ #----------------------------------------
+
+ def test06_Truncate(self):
+ d = self.d
+ if verbose:
+ print '\n', '-=' * 30
+ print "Running %s.test99_Truncate..." % self.__class__.__name__
+
+ d.put("abcde", "ABCDE");
+ num = d.truncate()
+ assert num >= 1, "truncate returned <= 0 on non-empty database"
+ num = d.truncate()
+ assert num == 0, "truncate on empty DB returned nonzero (%s)" % `num`
+
#----------------------------------------------------------------------
@@ -532,6 +554,22 @@ class BasicTransactionTestCase(BasicTestCase):
self.txn = self.env.txn_begin()
+ #----------------------------------------
+
+ def test07_TxnTruncate(self):
+ d = self.d
+ if verbose:
+ print '\n', '-=' * 30
+ print "Running %s.test07_TxnTruncate..." % self.__class__.__name__
+
+ d.put("abcde", "ABCDE");
+ txn = self.env.txn_begin()
+ num = d.truncate(txn)
+ assert num >= 1, "truncate returned <= 0 on non-empty database"
+ num = d.truncate(txn)
+ assert num == 0, "truncate on empty DB returned nonzero (%s)" % `num`
+ txn.commit()
+
class BTreeTransactionTestCase(BasicTransactionTestCase):