Esempio 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)
Esempio 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)
Esempio 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)
Esempio n. 4
0
def test_parse_fail_non_feature():
    with pytest.raises(ValueError):
        geojsonio.make_geojson(5)
Esempio 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
Esempio n. 6
0
def test_parse_string(features):
    contents = json.dumps(features)

    assert geojsonio.make_geojson(contents) == contents
Esempio 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)
Esempio n. 8
0
def test_parse_fail_non_feature():
    with pytest.raises(ValueError):
        geojsonio.make_geojson(5)
Esempio 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
Esempio n. 10
0
def test_parse_string(features):
    contents = json.dumps(features)

    assert geojsonio.make_geojson(contents) == contents