Exemplo n.º 1
0
    def test_polygon_set(self):
        query = GranuleQuery()

        query.polygon([(1, 1), (2, 1), (2, 2), (1, 1)])
        self.assertEqual(query.params["polygon"],
                         "1.0,1.0,2.0,1.0,2.0,2.0,1.0,1.0")

        query.polygon([("1", 1.1), (2, 1), (2, 2), (1, 1.1)])
        self.assertEqual(query.params["polygon"],
                         "1.0,1.1,2.0,1.0,2.0,2.0,1.0,1.1")
Exemplo n.º 2
0
    def test_invalid_spatial_state(self):
        query = GranuleQuery()

        query.point(1, 2)
        self.assertFalse(query._valid_state())

        query.polygon([(1, 1), (2, 1), (2, 2), (1, 1)])
        self.assertFalse(query._valid_state())

        query.bounding_box(1, 1, 2, 2)
        self.assertFalse(query._valid_state())

        query.line([(1, 1), (2, 2)])
        self.assertFalse(query._valid_state())
Exemplo n.º 3
0
    def test_polygon_invalid_set(self):
        query = GranuleQuery()

        with self.assertRaises(ValueError):
            query.polygon([1, 2, 3])
            query.polygon([("invalid", 1)])
            query.polygon([(1, 1), (2, 1), (1, 1)])