(capsys)
| 463 | |
| 464 | |
| 465 | def 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 | |
| 487 | def test_postparsing_hook_emptystatement_first(capsys) -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…