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