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