#NEWLINE# def testDispatch( self ) : #NEWLINE# #INDENT# dispatcher = GafferDispatch . Dispatcher . create ( 'testDispatcher' ) #NEWLINE# log = [ ] #NEWLINE# s = Gaffer . ScriptNode ( ) #NEWLINE# s [ 'n1' ] = GafferDispatchTest . LoggingExecutableNode ( log = log ) #NEWLINE# s [ 'n2' ] = GafferDispatchTest . LoggingExecutableNode ( log = log ) #NEWLINE# s [ 'n2a' ] = GafferDispatchTest . LoggingExecutableNode ( log = log ) #NEWLINE# s [ 'n2b' ] = GafferDispatchTest . LoggingExecutableNode ( log = log ) #NEWLINE# s [ 'n1' ] [ 'preTasks' ] [ 0 ] . setInput ( s [ 'n2' ] [ 'task' ] ) #NEWLINE# s [ 'n2' ] [ 'preTasks' ] [ 0 ] . setInput ( s [ 'n2a' ] [ 'task' ] ) #NEWLINE# s [ 'n2' ] [ 'preTasks' ] [ 1 ] . setInput ( s [ 'n2b' ] [ 'task' ] ) #NEWLINE# dispatcher . dispatch ( [ s [ 'n1' ] ] ) #NEWLINE# self . assertTrue ( ( ( [ l . node for l in log ] == [ s [ 'n2a' ] , s [ 'n2b' ] , s [ 'n2' ] , s [ 'n1' ] ] ) or ( [ l . node for l in log ] == [ s [ 'n2b' ] , s [ 'n2a' ] , s [ 'n2' ] , s [ 'n1' ] ] ) ) ) #NEWLINE# del log [ : ] #NEWLINE# dispatcher . dispatch ( [ s [ 'n2b' ] , s [ 'n1' ] ] ) #NEWLINE# self . assertTrue ( ( ( [ l . node for l in log ] == [ s [ 'n2a' ] , s [ 'n2b' ] , s [ 'n2' ] , s [ 'n1' ] ] ) or ( [ l . node for l in log ] == [ s [ 'n2b' ] , s [ 'n2a' ] , s [ 'n2' ] , s [ 'n1' ] ] ) ) ) #NEWLINE# del log [ : ] #NEWLINE# dispatcher . dispatch ( [ s [ 'n2' ] , s [ 'n2b' ] , s [ 'n1' ] , s [ 'n2a' ] ] ) #NEWLINE# self . assertTrue ( ( ( [ l . node for l in log ] == [ s [ 'n2a' ] , s [ 'n2b' ] , s [ 'n2' ] , s [ 'n1' ] ] ) or ( [ l . node for l in log ] == [ s [ 'n2b' ] , s [ 'n2a' ] , s [ 'n2' ] , s [ 'n1' ] ] ) ) ) #NEWLINE# del log [ : ] #NEWLINE# dispatcher . dispatch ( [ s [ 'n2' ] ] ) #NEWLINE# self . assertTrue ( ( ( [ l . node for l in log ] == [ s [ 'n2a' ] , s [ 'n2b' ] , s [ 'n2' ] ] ) or ( [ l . node for l in log ] == [ s [ 'n2b' ] , s [ 'n2a' ] , s [ 'n2' ] ] ) ) ) #NEWLINE# del log [ : ] #NEWLINE# dispatcher . dispatch ( [ s [ 'n2b' ] ] ) #NEWLINE# self . assertEqual ( [ l . node for l in log ] , [ s [ 'n2b' ] ] )