MCPcopy Index your code
hub / github.com/python-cmd2/cmd2 / test_postparsing_hook_stop_second

Function test_postparsing_hook_stop_second

tests/test_plugin.py:465–484  ·  view source on GitHub ↗
(capsys)

Source from the content-addressed store, hash-verified

463
464
465def test_postparsing_hook_stop_second(capsys) -> None:
466 app = PluggedApp()
467 app.register_postparsing_hook(app.postparse_hook)
468 stop = app.onecmd_plus_hooks("say hello")
469 assert app.called_postparsing == 1
470 assert not stop
471
472 # register another function and make sure it gets called
473 app.reset_counters()
474 app.register_postparsing_hook(app.postparse_hook_stop)
475 stop = app.onecmd_plus_hooks("say hello")
476 assert app.called_postparsing == 2
477 assert stop
478
479 # register a third function which shouldn't be called
480 app.reset_counters()
481 app.register_postparsing_hook(app.postparse_hook)
482 stop = app.onecmd_plus_hooks("say hello")
483 assert app.called_postparsing == 2
484 assert stop
485
486
487def test_postparsing_hook_emptystatement_first(capsys) -> None:

Callers

nothing calls this directly

Calls 4

PluggedAppClass · 0.85
onecmd_plus_hooksMethod · 0.80
reset_countersMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…