Ejemplo n.º 1
0
def test_parse_feature_collection():
    feature_collection = geo.parse(FEATURE_COLLECTION)
    assert len(feature_collection['features']) == 2
Ejemplo n.º 2
0
def test_parse_geometry_collection():
    geometry_collection = geo.parse(GEOMETRY_COLLECTION)
    assert len(geometry_collection['geometries']) == 3
Ejemplo n.º 3
0
def test_parse_feature():
    feature = geo.parse(FEATURE_1)
    assert feature['geometry'] == LINE_STRING
Ejemplo n.º 4
0
def test_parse_polygon_1_hole():
    polygon = geo.parse(POLYGON_1)
    assert polygon['coordinates'] == (EXTERIOR, [HOLE1])
Ejemplo n.º 5
0
def test_parse_polygon_2_holes():
    polygon = geo.parse(POLYGON_2)
    assert polygon['coordinates'] == (EXTERIOR, [HOLE1, HOLE2])
Ejemplo n.º 6
0
def test_parse_polygon_without_holes():
    polygon = geo.parse(POLYGON_0)
    assert polygon['coordinates'] == (EXTERIOR, []
                                      )
Ejemplo n.º 7
0
def test_parsing_value_error(entity):
    with pytest.raises(ValueError):
        geo.parse(entity)
Ejemplo n.º 8
0
def test_parsing_type_error():
    with pytest.raises(TypeError):
        geo.parse({'type': 'XXX'})
Ejemplo n.º 9
0
def test_parse_types(entity):
    # Parser does basic structure validation and converts all coordinates into
    # Vec3 objects.
    assert geo.parse(entity) == entity
Ejemplo n.º 10
0
def test_parsing_type_error():
    with pytest.raises(TypeError):
        geo.parse({"type": "XXX"})