0

renamed "level" to "depth" in DirtyTilesTree. Also...

iterate_dirty() yields tuples, not reverseiterators
added another level to test_iterate_level()
This commit is contained in:
Andrew Brown
2011-11-16 20:53:52 -05:00
parent 95b4ec5922
commit 4c34e413ab
2 changed files with 32 additions and 14 deletions

View File

@@ -65,7 +65,7 @@ class DirtyTilesTest(unittest.TestCase):
self.tree.set_dirty((1,1,1))
self.assertRaises(AssertionError, self.test_iterate)
# If something was supposed to be returned but didn't
# If something was supposed to be returned but wasn't
tree = DirtyTiles(3)
c = len(self.dirty_paths) // 2
for t in self.dirty_paths:
@@ -116,5 +116,14 @@ class DirtyTilesTest(unittest.TestCase):
l2.remove(p)
self.assertEqual(len(dirty), 0, "Never iterated over these items: %s" % l2)
# level 1
l1 = set()
for p in self.dirty_paths:
l1.add(p[0:1])
for p in self.tree.iterate_dirty(1):
self.assertTrue(p in l1, "%s was not supposed to be returned!" % (p,))
l1.remove(p)
self.assertEqual(len(dirty), 0, "Never iterated over these items: %s" % l1)
if __name__ == "__main__":
unittest.main()