MCPcopy Create free account
hub / github.com/ipython/ipython / test_command_chain_dispatcher_fofo

Function test_command_chain_dispatcher_fofo

IPython/core/tests/test_hooks.py:56–74  ·  view source on GitHub ↗

Test a mixture of failing and succeeding hooks.

()

Source from the content-addressed store, hash-verified

54 nt.assert_true(fail2.called)
55
56def test_command_chain_dispatcher_fofo():
57 """Test a mixture of failing and succeeding hooks."""
58 fail1 = Fail(u'fail1')
59 fail2 = Fail(u'fail2')
60 okay1 = Okay(u'okay1')
61 okay2 = Okay(u'okay2')
62
63 dp = CommandChainDispatcher([(0, fail1),
64 # (5, okay1), # add this later
65 (10, fail2),
66 (15, okay2)])
67 dp.add(okay1, 5)
68
69 nt.assert_equal(dp(), u'okay1')
70
71 nt.assert_true(fail1.called)
72 nt.assert_true(okay1.called)
73 nt.assert_false(fail2.called)
74 nt.assert_false(okay2.called)
75
76def test_command_chain_dispatcher_eq_priority():
77 okay1 = Okay(u'okay1')

Callers

nothing calls this directly

Calls 4

addMethod · 0.95
FailClass · 0.85
OkayClass · 0.85

Tested by

no test coverage detected