Esempio n. 1
0
def test_parse_feature_collection():
    feature_collection = geo.parse(FEATURE_COLLECTION)
    assert len(feature_collection['features']) == 2
Esempio n. 2
0
def test_parse_geometry_collection():
    geometry_collection = geo.parse(GEOMETRY_COLLECTION)
    assert len(geometry_collection['geometries']) == 3
Esempio n. 3
0
def test_parse_feature():
    feature = geo.parse(FEATURE_1)
    assert feature['geometry'] == LINE_STRING
Esempio n. 4
0
def test_parse_polygon_1_hole():
    polygon = geo.parse(POLYGON_1)
    assert polygon['coordinates'] == (EXTERIOR, [HOLE1])
Esempio n. 5
0
def test_parse_polygon_2_holes():
    polygon = geo.parse(POLYGON_2)
    assert polygon['coordinates'] == (EXTERIOR, [HOLE1, HOLE2])
Esempio n. 6
0
def test_parse_polygon_without_holes():
    polygon = geo.parse(POLYGON_0)
    assert polygon['coordinates'] == (EXTERIOR, []
                                      )
Esempio n. 7
0
def test_parsing_value_error(entity):
    with pytest.raises(ValueError):
        geo.parse(entity)
Esempio n. 8
0
def test_parsing_type_error():
    with pytest.raises(TypeError):
        geo.parse({'type': 'XXX'})
Esempio 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
Esempio n. 10
0
def test_parsing_type_error():
    with pytest.raises(TypeError):
        geo.parse({"type": "XXX"})