示例#1
0
 def test_query(self):
     """Make sure the correct tiles in the set"""
     for path in iterate_base4(3):
         if path in self.tile_paths:
             self.assertTrue(self.tree.query_path(path))
         else:
             self.assertFalse(self.tree.query_path(path))
 def test_query(self):
     """Make sure the correct tiles in the set"""
     for path in iterate_base4(3):
         if path in self.tile_paths:
             self.assertTrue( self.tree.query_path(path) )
         else:
             self.assertFalse( self.tree.query_path(path) )
    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 iterate_base4(7):
            t1 = RenderTile.from_path(path)
            col = t1.col
            row = t1.row
            depth = len(path)

            t2 = RenderTile.compute_path(col, row, depth)
            self.assertEqual(t1, t2)
示例#4
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 iterate_base4(7):
            t1 = RenderTile.from_path(path)
            col = t1.col
            row = t1.row
            depth = len(path)

            t2 = RenderTile.compute_path(col, row, depth)
            self.assertEqual(t1, t2)
示例#5
0
    def test_query_level(self):
        "Tests querying at a level other than max"
        # level 2
        l2 = set()
        for p in self.tile_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, )))
    def test_query_level(self):
        "Tests querying at a level other than max"
        # level 2
        l2 = set()
        for p in self.tile_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,)))