88from shapely .geometry import shape
99
1010from rasterstats .io import ( # todo parse_feature
11- fiona_generator ,
1211 Raster ,
1312 boundless_array ,
1413 bounds_window ,
14+ fiona_generator ,
1515 read_featurecollection ,
1616 read_features ,
1717 rowcol ,
@@ -47,7 +47,7 @@ def _test_read_features(indata):
4747
4848def _test_read_features_single (indata ):
4949 # single (first target geom)
50- geom = shape (list ( read_features (indata ))[ 0 ] ["geometry" ])
50+ geom = shape (next ( iter ( read_features (indata ))) ["geometry" ])
5151 assert geom .equals_exact (target_geoms [0 ], eps )
5252
5353
@@ -280,9 +280,9 @@ def test_Raster():
280280 r2 = Raster (arr , affine , nodata , band = 1 ).read (bounds )
281281
282282 with pytest .raises (ValueError ):
283- r3 = Raster (arr , affine , nodata , band = 1 ).read ()
283+ Raster (arr , affine , nodata , band = 1 ).read ()
284284 with pytest .raises (ValueError ):
285- r4 = Raster (arr , affine , nodata , band = 1 ).read (bounds = 1 , window = 1 )
285+ Raster (arr , affine , nodata , band = 1 ).read (bounds = 1 , window = 1 )
286286
287287 # If the abstraction is correct, the arrays are equal
288288 assert np .array_equal (r1 .array , r2 .array )
@@ -301,7 +301,7 @@ def test_Raster_boundless_disabled():
301301
302302 # rasterio src fails outside extent
303303 with pytest .raises (ValueError ):
304- r1 = Raster (raster , band = 1 ).read (outside_bounds , boundless = False )
304+ Raster (raster , band = 1 ).read (outside_bounds , boundless = False )
305305
306306 # rasterio src works inside extent
307307 r2 = Raster (raster , band = 1 ).read (bounds , boundless = False )
@@ -316,7 +316,7 @@ def test_Raster_boundless_disabled():
316316
317317 # ndarray src fails outside extent
318318 with pytest .raises (ValueError ):
319- r4 = Raster (arr , affine , nodata , band = 1 ).read (outside_bounds , boundless = False )
319+ Raster (arr , affine , nodata , band = 1 ).read (outside_bounds , boundless = False )
320320
321321 # If the abstraction is correct, the arrays are equal
322322 assert np .array_equal (r2 .array , r3 .array )
0 commit comments