def test_shapes_band(pixelated_image, pixelated_image_file):

    with Env():
        truth = list(shapes(pixelated_image))

        with rasterio.open(pixelated_image_file) as src:
            band = rasterio.band(src, 1)
            assert truth == list(shapes(band))

            # Mask band should function, but will mask out some results
            assert truth[0] == list(shapes(band, mask=band))[0]
Shapes from a band should match shapes from an array
dataset/ETHPy150Open mapbox/rasterio/tests/test_features.py/test_shapes_band