Exemplo n.º 1
0
def test_parse_single_feature_geo(features):
    feature = features['features'][0]
    o = GeoDict(feature)

    expected = {'type': 'FeatureCollection', 'features': [feature]}

    contents = geojsonio.make_geojson(o)
    assert contents == json.dumps(expected)
Exemplo n.º 2
0
def test_parse_single_feature_geo(features):
    feature = features['features'][0]
    o = GeoDict(feature)

    expected = {
        'type': 'FeatureCollection',
        'features': [feature]
    }

    contents = geojsonio.make_geojson(o)
    assert contents == json.dumps(expected)
Exemplo n.º 3
0
def test_parse_fail_list_non_feature(features):
    os = [GeoDict(features['features'][0]), 5]
    with pytest.raises(ValueError):
        geojsonio.make_geojson(os)
Exemplo n.º 4
0
def test_parse_fail_non_feature():
    with pytest.raises(ValueError):
        geojsonio.make_geojson(5)
Exemplo n.º 5
0
def test_parse_list_features_geo(features):
    os = [GeoDict(f) for f in features['features']]
    contents = geojsonio.make_geojson(os)

    dict_contents = json.loads(contents)
    assert features == dict_contents
Exemplo n.º 6
0
def test_parse_string(features):
    contents = json.dumps(features)

    assert geojsonio.make_geojson(contents) == contents
Exemplo n.º 7
0
def test_parse_fail_list_non_feature(features):
    os = [GeoDict(features['features'][0]), 5]
    with pytest.raises(ValueError):
        geojsonio.make_geojson(os)
Exemplo n.º 8
0
def test_parse_fail_non_feature():
    with pytest.raises(ValueError):
        geojsonio.make_geojson(5)
Exemplo n.º 9
0
def test_parse_list_features_geo(features):
    os = [GeoDict(f) for f in features['features']]
    contents = geojsonio.make_geojson(os)

    dict_contents = json.loads(contents)
    assert features == dict_contents
Exemplo n.º 10
0
def test_parse_string(features):
    contents = json.dumps(features)

    assert geojsonio.make_geojson(contents) == contents