Пример #1
0
 def test_query(self):
     """Make sure the correct tiles are marked as dirty"""
     for path in iterate_base4(3):
         if path in self.dirty_paths:
             self.assertTrue( self.tree.query_path(path) )
         else:
             self.assertFalse( self.tree.query_path(path) )
Пример #2
0
    def test_compute_path(self):
        """Tests that the correct path is computed when a col,row,depth is
        given to compute_path

        """
        for path in quadtree.iterate_base4(7):
            t1 = Tile.from_path(path)
            col = t1.col
            row = t1.row
            depth = len(path)

            t2 = Tile.compute_path(col, row, depth)
            self.assertEqual(t1, t2)
Пример #3
0
    def test_compute_path(self):
        """Tests that the correct path is computed when a col,row,depth is
        given to compute_path

        """
        for path in quadtree.iterate_base4(7):
            t1 = Tile.from_path(path)
            col = t1.col
            row = t1.row
            depth = len(path)

            t2 = Tile.compute_path(col, row, depth)
            self.assertEqual(t1, t2)
Пример #4
0
    def test_query_level(self):
        "Tests querying at a level other than max"
        # level 2
        l2 = set()
        for p in self.dirty_paths:
            l2.add(p[0:2])
        for path in iterate_base4(2):
            if path in l2:
                self.assertTrue( self.tree.query_path(path) )
            else:
                self.assertFalse( self.tree.query_path(path) )

        # level 1:
        self.assertTrue( self.tree.query_path((0,)))
        self.assertTrue( self.tree.query_path((1,)))
        self.assertTrue( self.tree.query_path((2,)))
        self.assertFalse( self.tree.query_path((3,)))