#NEWLINE# def test_take_sorted( ) : #NEWLINE# #INDENT# ( chunks , dsk ) = take ( 'y' , 'x' , [ ( 20 , 20 , 20 , 20 ) ] , [ 1 , 3 , 5 , 47 ] , axis = 0 ) #NEWLINE# expected = { #NEWLINE# #INDENT# ( 'y' , 0 ) : ( getitem , ( 'x' , 0 ) , ( [ 1 , 3 , 5 ] , ) ) , #NEWLINE# ( 'y' , 1 ) : ( getitem , ( 'x' , 2 ) , ( [ 7 ] , ) ) , #NEWLINE# #UNINDENT# } #NEWLINE# assert ( dsk == expected ) #NEWLINE# assert ( chunks == ( ( 3 , 1 ) , ) ) #NEWLINE# ( chunks , dsk ) = take ( 'y' , 'x' , [ ( 20 , 20 , 20 , 20 ) , ( 20 , 20 ) ] , [ 1 , 3 , 5 , 37 ] , axis = 1 ) #NEWLINE# expected = merge ( dict ( ( ( ( 'y' , i , 0 ) , ( getitem , ( 'x' , i , 0 ) , ( slice ( None , None , None ) , [ 1 , 3 , 5 ] ) ) ) for i in range ( 4 ) ) ) , dict ( ( ( ( 'y' , i , 1 ) , ( getitem , ( 'x' , i , 1 ) , ( slice ( None , None , None ) , [ 17 ] ) ) ) for i in range ( 4 ) ) ) ) #NEWLINE# assert ( dsk == expected ) #NEWLINE# assert ( chunks == ( ( 20 , 20 , 20 , 20 ) , ( 3 , 1 ) ) )