#NEWLINE# def test_with_get( ) : #NEWLINE# #INDENT# var = [ 0 ] #NEWLINE# def myget( dsk , keys , **kwargs ) : #NEWLINE# #INDENT# var [ 0 ] = ( var [ 0 ] + 1 ) #NEWLINE# return dask . get ( dsk , keys , ** kwargs ) #NEWLINE# #UNINDENT# x = da . ones ( 10 , chunks = ( 5 , ) ) #NEWLINE# assert ( x . sum ( ) . compute ( ) == 10 ) #NEWLINE# assert ( var [ 0 ] == 0 ) #NEWLINE# with set_options ( get = myget ) : #NEWLINE# #INDENT# assert ( x . sum ( ) . compute ( ) == 10 ) #NEWLINE# #UNINDENT# assert ( var [ 0 ] == 1 ) #NEWLINE# assert ( x . sum ( ) . compute ( ) == 10 ) #NEWLINE# assert ( var [ 0 ] == 1 )