#NEWLINE# def test_slicing_with_lists( ) : #NEWLINE# #INDENT# nx = np . arange ( 20 ) . reshape ( ( 4 , 5 ) ) #NEWLINE# dx = from_array ( nx , ( 2 , 2 ) ) #NEWLINE# sx = symbol ( 'x' , discover ( dx ) ) #NEWLINE# expr = sx [ [ 2 , 0 , 3 ] ] #NEWLINE# assert eq ( np . array ( compute ( expr , dx ) ) , compute ( expr , nx ) ) #NEWLINE# expr = sx [ : : 2 , [ 2 , 0 , 3 ] ] #NEWLINE# assert eq ( np . array ( compute ( expr , dx ) ) , compute ( expr , nx ) ) #NEWLINE# expr = sx [ ( 1 , [ 2 , 0 , 3 ] ) ] #NEWLINE# assert eq ( np . array ( compute ( expr , dx ) ) , compute ( expr , nx ) ) #NEWLINE# expr = sx [ ( [ 2 , 0 , 3 ] , ( - 2 ) ) ] #NEWLINE# assert eq ( np . array ( compute ( expr , dx ) ) , compute ( expr , nx ) ) #NEWLINE# expr = sx [ : , : ] #NEWLINE# assert ( compute ( expr , dx ) . dask == dx . dask ) #NEWLINE# expr = sx [ 0 ] #NEWLINE# assert eq ( np . array ( compute ( expr , dx ) ) , compute ( expr , nx ) ) #NEWLINE# expr = sx [ ( 0 , [ 3 , 1 , 4 ] ) ] #NEWLINE# assert eq ( np . array ( compute ( expr , dx ) ) , compute ( sx , nx ) )