Rev 4753: Move the note and assertions. in http://bazaar.launchpad.net/~jameinel/bzr/2.1-peak-mem-tweak

John Arbash Meinel john at arbash-meinel.com
Tue Oct 20 05:25:37 BST 2009


At http://bazaar.launchpad.net/~jameinel/bzr/2.1-peak-mem-tweak

------------------------------------------------------------
revno: 4753
revision-id: john at arbash-meinel.com-20091020042527-ehogm27th7o4htt6
parent: john at arbash-meinel.com-20091019162120-dpa2zoqquvl5ai7p
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.1-peak-mem-tweak
timestamp: Mon 2009-10-19 23:25:27 -0500
message:
  Move the note and assertions.
  
  We will assert that the internal node cache doesn't change,
  though since it is empty, it isn't asserting much... :)
-------------- next part --------------
=== modified file 'bzrlib/tests/test_btree_index.py'
--- a/bzrlib/tests/test_btree_index.py	2009-10-19 15:45:10 +0000
+++ b/bzrlib/tests/test_btree_index.py	2009-10-20 04:25:27 +0000
@@ -651,17 +651,19 @@
         self.assertEqual(1, len(list(index.iter_entries([nodes[30][0]]))))
         self.assertEqual([1, 4], index._row_lengths)
         self.assertIsNot(None, index._root_node)
-        # NOTE: we don't want to affect the _internal_node_cache, as we expect
-        #       it will be small, and if we ever do touch this index again, it
-        #       will save round-trips. However, it requires a 3-level tree to
-        #       test this...
-        # self.assertTrue(len(index._internal_node_cache) > 0)
+        internal_node_pre_clear = index._internal_node_cache.keys()
         self.assertTrue(len(index._leaf_node_cache) > 0)
         index.clear_cache()
         # We don't touch _root_node or _internal_node_cache, both should be
         # small, and can save a round trip or two
         self.assertIsNot(None, index._root_node)
-        # self.assertTrue(len(index._internal_node_cache) > 0)
+        # NOTE: We don't want to affect the _internal_node_cache, as we expect
+        #       it will be small, and if we ever do touch this index again, it
+        #       will save round-trips.  This assertion isn't very strong,
+        #       becuase without a 3-level index, we don't have any internal
+        #       nodes cached.
+        self.assertEqual(internal_node_pre_clear,
+                         index._internal_node_cache.keys())
         self.assertEqual(0, len(index._leaf_node_cache))
 
     def test_trivial_constructor(self):



More information about the bazaar-commits mailing list