Exemplo n.º 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))
Exemplo n.º 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))
Exemplo n.º 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))
Exemplo n.º 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))
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)