MCPcopy Create free account
hub / github.com/apache/qpid-proton / do_customEvent

Method do_customEvent

python/tests/proton_tests/handler.py:66–97  ·  view source on GitHub ↗
(self, reactor_handler, event_root)

Source from the content-addressed store, hash-verified

64 self.test_reactorHandlerCycling(100)
65
66 def do_customEvent(self, reactor_handler, event_root):
67
68 class CustomHandler:
69 did_custom = False
70 did_init = False
71
72 def __init__(self, *handlers):
73 self.handlers = handlers
74
75 def on_reactor_init(self, event):
76 self.did_init = True
77
78 def on_custom(self, event):
79 self.did_custom = True
80
81 class CustomInvoker(CustomHandler):
82 def on_reactor_init(self, event):
83 h = event_root(event)
84 event.dispatch(h, CUSTOM)
85 self.did_init = True
86
87 child = CustomInvoker()
88 root = CustomHandler(child)
89
90 container = Container()
91
92 reactor_handler(container, root)
93 container.run()
94 assert root.did_init
95 assert child.did_init
96 assert root.did_custom
97 assert child.did_custom
98
99 def set_root(self, reactor, root):
100 reactor.handler = root

Callers 6

test_set_handlerMethod · 0.95
test_add_handlerMethod · 0.95
test_append_handlerMethod · 0.95
test_set_rootMethod · 0.95
test_add_rootMethod · 0.95
test_append_rootMethod · 0.95

Calls 4

runMethod · 0.95
ContainerClass · 0.90
CustomInvokerClass · 0.85
CustomHandlerClass · 0.85

Tested by 6

test_set_handlerMethod · 0.76
test_add_handlerMethod · 0.76
test_append_handlerMethod · 0.76
test_set_rootMethod · 0.76
test_add_rootMethod · 0.76
test_append_rootMethod · 0.76