MCPcopy Index your code
hub / github.com/ipython/ipython / test_command_chain_dispatcher_fofo

Function test_command_chain_dispatcher_fofo

tests/test_hooks.py:59–81  ·  view source on GitHub ↗

Test a mixture of failing and succeeding hooks.

()

Source from the content-addressed store, hash-verified

57
58
59def test_command_chain_dispatcher_fofo():
60 """Test a mixture of failing and succeeding hooks."""
61 fail1 = Fail("fail1")
62 fail2 = Fail("fail2")
63 okay1 = Okay("okay1")
64 okay2 = Okay("okay2")
65
66 dp = CommandChainDispatcher(
67 [
68 (0, fail1),
69 # (5, okay1), # add this later
70 (10, fail2),
71 (15, okay2),
72 ]
73 )
74 dp.add(okay1, 5)
75
76 assert dp() == "okay1"
77
78 assert fail1.called is True
79 assert okay1.called is True
80 assert fail2.called is False
81 assert okay2.called is False
82
83
84def test_command_chain_dispatcher_eq_priority():

Callers

nothing calls this directly

Calls 4

addMethod · 0.95
FailClass · 0.85
OkayClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…