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