def test_read_geojson_features(): expected = [(-87.33787536621092, 36.539156961321574), (-88.2476806640625, 36.92217534275667)] assert expected == list(read_points(gj_point_features)) assert expected == list(read_points(gj_multipoint_features)) assert expected == list(read_points(gj_line_features))
def test_geo_interface(): expected = [(-87.33787536621092, 36.539156961321574), (-88.2476806640625, 36.92217534275667)] features = [GeoThing(gj_point_features[0]), GeoThing(gj_point_features[1])] assert expected == list(read_points(features)) geoms = [GeoThing(gj_point_features[0]['geometry']), GeoThing(gj_point_features[1]['geometry'])] assert expected == list(read_points(geoms))
def test_unsupported_geometry(): unsupported = copy.deepcopy(gj_point_features) unsupported[0]['geometry']['type'] = "MultiPolygonnnnnn" with pytest.raises(ValueError) as exc: list(read_points(unsupported)) assert 'Unsupported geometry' in str(exc.value)
def test_unknown_object(): unknown = ["foo", "bar"] with pytest.raises(ValueError) as exc: list(read_points(unknown)) assert 'Unknown object' in str(exc.value)