651
651
self.assertEqual(1, len(list(index.iter_entries([nodes[30][0]]))))
652
652
self.assertEqual([1, 4], index._row_lengths)
653
653
self.assertIsNot(None, index._root_node)
654
# NOTE: we don't want to affect the _internal_node_cache, as we expect
655
# it will be small, and if we ever do touch this index again, it
656
# will save round-trips. However, it requires a 3-level tree to
658
# self.assertTrue(len(index._internal_node_cache) > 0)
654
internal_node_pre_clear = index._internal_node_cache.keys()
659
655
self.assertTrue(len(index._leaf_node_cache) > 0)
660
656
index.clear_cache()
661
657
# We don't touch _root_node or _internal_node_cache, both should be
662
658
# small, and can save a round trip or two
663
659
self.assertIsNot(None, index._root_node)
664
# self.assertTrue(len(index._internal_node_cache) > 0)
660
# NOTE: We don't want to affect the _internal_node_cache, as we expect
661
# it will be small, and if we ever do touch this index again, it
662
# will save round-trips. This assertion isn't very strong,
663
# becuase without a 3-level index, we don't have any internal
665
self.assertEqual(internal_node_pre_clear,
666
index._internal_node_cache.keys())
665
667
self.assertEqual(0, len(index._leaf_node_cache))
667
669
def test_trivial_constructor(self):