[Python-checkins] r66324 - sandbox/trunk/dbm_sqlite/Lib/test/test_dbm_sqlite.py

skip.montanaro python-checkins at python.org
Tue Sep 9 04:35:36 CEST 2008


Author: skip.montanaro
Date: Tue Sep  9 04:35:35 2008
New Revision: 66324

Log:
add len() test.


Modified:
   sandbox/trunk/dbm_sqlite/Lib/test/test_dbm_sqlite.py

Modified: sandbox/trunk/dbm_sqlite/Lib/test/test_dbm_sqlite.py
==============================================================================
--- sandbox/trunk/dbm_sqlite/Lib/test/test_dbm_sqlite.py	(original)
+++ sandbox/trunk/dbm_sqlite/Lib/test/test_dbm_sqlite.py	Tue Sep  9 04:35:35 2008
@@ -61,6 +61,15 @@
         keys = self.keys_helper(f)
         f.close()
 
+    def test_len(self):
+        f = dbm.sqlite.open(_fname)
+        self.assertEqual(len(f), 0)
+        f[b'1'] = b'hello'
+        self.assertEqual(len(f), 1)
+        f[b'1'] = b'goodbye'
+        self.assertEqual(len(f), 1)
+        f.close()
+
     def test_write_contains(self):
         f = dbm.sqlite.open(_fname)
         f[b'1'] = b'hello'
@@ -77,6 +86,13 @@
         self.assertEqual(f[b'1'], b'hello2')
         f.close()
 
+    def test_write_then_read(self):
+        # test for bug #482460
+        f = dbm.sqlite.open(_fname)
+        f[b'1'] = b'hello'
+        self.assertEqual(f[b'1'], b'hello')
+        f.close()
+
     def read_helper(self, f):
         keys = self.keys_helper(f)
         for key in self._dict:


More information about the Python-checkins mailing list