Example #1
0
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))
Example #2
0
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))
Example #3
0
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))
Example #4
0
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))
Example #5
0
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)
Example #6
0
def test_unknown_object():
    unknown = ["foo", "bar"]
    with pytest.raises(ValueError) as exc:
        list(read_points(unknown))
    assert 'Unknown object' in str(exc.value)
Example #7
0
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)
Example #8
0
def test_unknown_object():
    unknown = ["foo", "bar"]
    with pytest.raises(ValueError) as exc:
        list(read_points(unknown))
    assert 'Unknown object' in str(exc.value)