@@ -73,18 +73,14 @@ class GenericProperties(BaseModel):
73
73
74
74
def test_feature_collection_iteration ():
75
75
"""test if feature collection is iterable"""
76
- gc = FeatureCollection (
77
- type = "FeatureCollection" , features = [test_feature , test_feature ]
78
- )
76
+ gc = FeatureCollection (type = "FeatureCollection" , features = [test_feature , test_feature ])
79
77
assert hasattr (gc , "__geo_interface__" )
80
78
iter (gc )
81
79
82
80
83
81
def test_geometry_collection_iteration ():
84
82
"""test if feature collection is iterable"""
85
- gc = FeatureCollection (
86
- type = "FeatureCollection" , features = [test_feature_geometry_collection ]
87
- )
83
+ gc = FeatureCollection (type = "FeatureCollection" , features = [test_feature_geometry_collection ])
88
84
assert hasattr (gc , "__geo_interface__" )
89
85
iter (gc )
90
86
@@ -100,9 +96,7 @@ def test_generic_properties_is_dict():
100
96
def test_generic_properties_is_dict_collection ():
101
97
feature = Feature (** test_feature_geometry_collection )
102
98
assert hasattr (feature , "__geo_interface__" )
103
- assert (
104
- feature .properties ["id" ] == test_feature_geometry_collection ["properties" ]["id" ]
105
- )
99
+ assert feature .properties ["id" ] == test_feature_geometry_collection ["properties" ]["id" ]
106
100
assert type (feature .properties ) == dict
107
101
assert not hasattr (feature .properties , "id" )
108
102
@@ -132,9 +126,7 @@ def test_generic_geometry():
132
126
133
127
134
128
def test_generic_geometry_collection ():
135
- feature = Feature [GeometryCollection , GenericProperties ](
136
- ** test_feature_geometry_collection
137
- )
129
+ feature = Feature [GeometryCollection , GenericProperties ](** test_feature_geometry_collection )
138
130
assert feature .properties .id == test_feature_geometry_collection ["properties" ]["id" ]
139
131
assert type (feature .geometry ) == GeometryCollection
140
132
assert feature .geometry .wkt .startswith ("GEOMETRYCOLLECTION (POLYGON " )
@@ -143,9 +135,7 @@ def test_generic_geometry_collection():
143
135
144
136
feature = Feature [GeometryCollection , Dict ](** test_feature_geometry_collection )
145
137
assert type (feature .geometry ) == GeometryCollection
146
- assert (
147
- feature .properties ["id" ] == test_feature_geometry_collection ["properties" ]["id" ]
148
- )
138
+ assert feature .properties ["id" ] == test_feature_geometry_collection ["properties" ]["id" ]
149
139
assert type (feature .properties ) == dict
150
140
assert not hasattr (feature .properties , "id" )
151
141
@@ -155,13 +145,11 @@ def test_generic_geometry_collection():
155
145
156
146
def test_generic_properties_should_raise_for_string ():
157
147
with pytest .raises (ValidationError ):
158
- Feature (
159
- ** ({"type" : "Feature" , "geometry" : polygon , "properties" : "should raise" })
160
- )
148
+ Feature (** ({"type" : "Feature" , "geometry" : polygon , "properties" : "should raise" }))
161
149
162
150
163
151
def test_feature_collection_generic ():
164
- fc = FeatureCollection [Polygon , GenericProperties ](
152
+ fc = FeatureCollection [Feature [ Polygon , GenericProperties ] ](
165
153
type = "FeatureCollection" , features = [test_feature , test_feature ]
166
154
)
167
155
assert len (fc ) == 2
@@ -231,12 +219,8 @@ def test_feature_validation():
231
219
# missing geometry
232
220
Feature (type = "Feature" , properties = None )
233
221
234
- assert Feature (
235
- type = "Feature" , properties = None , bbox = (0 , 0 , 100 , 100 ), geometry = None
236
- )
237
- assert Feature (
238
- type = "Feature" , properties = None , bbox = (0 , 0 , 0 , 100 , 100 , 100 ), geometry = None
239
- )
222
+ assert Feature (type = "Feature" , properties = None , bbox = (0 , 0 , 100 , 100 ), geometry = None )
223
+ assert Feature (type = "Feature" , properties = None , bbox = (0 , 0 , 0 , 100 , 100 , 100 ), geometry = None )
240
224
241
225
with pytest .raises (ValidationError ):
242
226
# bad bbox2d
0 commit comments