def test_feature_collection_schema_of_empty_set(): fc = FeatureCollection([]) assert fc.schema == {"geometry": None, "properties": {}} with tempfile.NamedTemporaryFile(suffix=".json") as target: fc.save(target.name) fc2 = FileCollection.open(target.name) assert fc == fc2
def test_featurecollection_save_has_no_side_effects(): fc = FeatureCollection([ GeoFeature(GeoVector(Point(0, 0)), {'attr1': 1}), GeoFeature(GeoVector(Point(0, 0)), {'attr2': 1}) ]) with tempfile.NamedTemporaryFile(suffix=".json") as fp: fc.save(fp.name) assert fc[0].attributes == {'attr1': 1} assert fc[1].attributes == {'attr2': 1}