def test_command_chain_dispatcher_fofo():
 fail1 = Fail(u'fail1')
 fail2 = Fail(u'fail2')
 okay1 = Okay(u'okay1')
 okay2 = Okay(u'okay2')
 dp = CommandChainDispatcher([(0, fail1), (10, fail2), (15, okay2)])
 dp.add(okay1, 5)
 nt.assert_equal(dp(), u'okay1')
 nt.assert_true(fail1.called)
 nt.assert_true(okay1.called)
 nt.assert_false(fail2.called)
 nt.assert_false(okay2.called)

def test_command_chain_dispatcher_fofo ( ) : fail1 = Fail ( u'fail1' ) fail2 = Fail ( u'fail2' ) okay1 = Okay ( u'okay1' ) okay2 = Okay ( u'okay2' ) dp = CommandChainDispatcher ( [ ( 0 , fail1 ) , ( 10 , fail2 ) , ( 15 , okay2 ) ] ) dp . add ( okay1 , 5 ) nt . assert_equal ( dp ( ) , u'okay1' ) nt . assert_true ( fail1 . called ) nt . assert_true ( okay1 . called ) nt . assert_false ( fail2 . called ) nt . assert_false ( okay2 . called )
test a mixture of failing and succeeding hooks .