#NEWLINE# def test_shapes_mask( basic_image ) : #NEWLINE# #INDENT# ' Only pixels not masked out should be converted to features ' #NEWLINE# mask = numpy . ones ( basic_image . shape , dtype = rasterio . bool_ ) #NEWLINE# mask [ 4 : 5 , 4 : 5 ] = False #NEWLINE# with Env ( ) : #NEWLINE# #INDENT# results = list ( shapes ( basic_image , mask = mask ) ) #NEWLINE# assert ( len ( results ) == 2 ) #NEWLINE# ( shape , value ) = results [ 0 ] #NEWLINE# assert ( shape == { #NEWLINE# #INDENT# 'coordinates' : [ [ ( 2 , 2 ) , ( 2 , 5 ) , ( 4 , 5 ) , ( 4 , 4 ) , ( 5 , 4 ) , ( 5 , 2 ) , ( 2 , 2 ) ] ] , #NEWLINE# 'type' : 'Polygon' , #NEWLINE# #UNINDENT# } ) #NEWLINE# assert ( value == 1 )