Rev 3890: Add tests that *adding* an entry also triggers the cleanup code. in http://bzr.arbash-meinel.com/branches/bzr/1.11/fifo_cache

John Arbash Meinel john at arbash-meinel.com
Tue Dec 9 22:00:24 GMT 2008


At http://bzr.arbash-meinel.com/branches/bzr/1.11/fifo_cache

------------------------------------------------------------
revno: 3890
revision-id: john at arbash-meinel.com-20081209220003-05o6ymacid6io8mn
parent: john at arbash-meinel.com-20081209215736-6rvlqtzobqbwqn2m
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: fifo_cache
timestamp: Tue 2008-12-09 16:00:03 -0600
message:
  Add tests that *adding* an entry also triggers the cleanup code.
-------------- next part --------------
=== modified file 'bzrlib/tests/test_fifo_cache.py'
--- a/bzrlib/tests/test_fifo_cache.py	2008-12-09 21:57:36 +0000
+++ b/bzrlib/tests/test_fifo_cache.py	2008-12-09 22:00:03 +0000
@@ -158,11 +158,19 @@
         c[5] = 6 # no cleanup for 5
         self.assertEqual([], log)
         # Adding another key should cleanup 1 & 2
-        c[6] = 7
+        c.add(6, 7, cleanup=logging_cleanup)
         self.assertEqual([(1, 2), (2, 3)], log)
         del log[:]
-        c.clear()
+        # replacing 3 should trigger a cleanup
+        c.add(3, 8, cleanup=logging_cleanup)
         self.assertEqual([(3, 4)], log)
+        del log[:]
+        c[3] = 9
+        self.assertEqual([(3, 8)], log)
+        del log[:]
+        # Clearing everything should call all remaining cleanups
+        c.clear()
+        self.assertEqual([(6, 7)], log)
 
     def test_cleanup_at_deconstruct(self):
         log = []



More information about the bazaar-commits mailing list