Exemplo n.º 1
0
def test_multipoint():
    valid_full = {
        "type": "MultiPoint",
        "coordinates": [[-32.94682, -60.63932], [-32.94682, -60.63932, 10.0]]
    }

    multipoint = GeometryObjectSchema().load(valid_full)
    assert valid_full == multipoint == GeometryObjectSchema().dump(multipoint)
Exemplo n.º 2
0
def test_polygon():
    valid_full = {
        "type":
        "Polygon",
        "coordinates": [[[2.38, 57.322], [23.194, -20.28], [-120.43, 19.15],
                         [2.38, 57.322]]]
    }

    polygon = GeometryObjectSchema().load(valid_full)
    assert valid_full == polygon == GeometryObjectSchema().dump(polygon)
Exemplo n.º 3
0
def test_no_type_fail():
    invalid_no_type = {"coordinates": [-32.94682, -60.63932]}

    pytest.raises(ValidationError,
                  GeometryObjectSchema().load, invalid_no_type)
Exemplo n.º 4
0
def test_not_supported_type_fail():
    invalid_type = {"type": "invalid"}

    pytest.raises(ValidationError, GeometryObjectSchema().load, invalid_type)
Exemplo n.º 5
0
def test_point_no_coordinates_fail(geotype):
    invalid_point = {"type": geotype}

    pytest.raises(ValidationError, GeometryObjectSchema().load, invalid_point)
Exemplo n.º 6
0
def test_polygon_fail():
    invalid_input = {
        "type": "Polygon",
        "coordinates": [[[2.38, 57.322], [23.194, -20.28], [2.38, 57.322]]]
    }
    pytest.raises(ValidationError, GeometryObjectSchema().load, invalid_input)
Exemplo n.º 7
0
def test_multipoint_fail():
    invalid_input = {
        "type": "MultiPoint",
        "coordinates": [-32.94682, -60.63932]
    }
    pytest.raises(ValidationError, GeometryObjectSchema().load, invalid_input)
Exemplo n.º 8
0
def test_point():
    valid_full = {"type": "Point", "coordinates": [-32.94682, -60.63932]}

    point = GeometryObjectSchema().load(valid_full)
    assert valid_full == point == GeometryObjectSchema().dump(point)