def test_prefer_broker_nodes():
 (a, b, c) = 'abc'
 dsk = {(a, 0): (f,), (a, 1): (f,), (b, 0): (f, (a, 0)), (b, 1): (f, (a, 1)), (b, 2): (f, (a, 1))}
 o = order(dsk)
 assert (o[(a, 1)] < o[(a, 0)])
 dsk = {(a, 0): (f,), (a, 1): (f,), (b, 0): (f, (a, 0)), (b, 1): (f, (a, 1)), (b, 2): (f, (a, 0))}
 o = order(dsk)
 assert (o[(a, 1)] > o[(a, 0)])

def test_prefer_broker_nodes ( ) : ( a , b , c ) = 'abc' dsk = { ( a , 0 ) : ( f , ) , ( a , 1 ) : ( f , ) , ( b , 0 ) : ( f , ( a , 0 ) ) , ( b , 1 ) : ( f , ( a , 1 ) ) , ( b , 2 ) : ( f , ( a , 1 ) ) } o = order ( dsk ) assert ( o [ ( a , 1 ) ] < o [ ( a , 0 ) ] ) dsk = { ( a , 0 ) : ( f , ) , ( a , 1 ) : ( f , ) , ( b , 0 ) : ( f , ( a , 0 ) ) , ( b , 1 ) : ( f , ( a , 1 ) ) , ( b , 2 ) : ( f , ( a , 0 ) ) } o = order ( dsk ) assert ( o [ ( a , 1 ) ] > o [ ( a , 0 ) ] )
b0 b1 b2 a0 a1 a1 should be run before a0 .