We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e8653da commit 2c91df0Copy full SHA for 2c91df0
tests/test_future_annotations.py
@@ -0,0 +1,22 @@
1
+from __future__ import annotations
2
+
3
+import cmd2
4
5
+from .conftest import normalize, run_cmd
6
7
8
+def test_hooks_work_with_future_annotations() -> None:
9
+ class HookApp(cmd2.Cmd):
10
+ def __init__(self, *args, **kwargs) -> None:
11
+ super().__init__(*args, **kwargs)
12
+ self.register_cmdfinalization_hook(self.hook)
13
14
+ def hook(self: cmd2.Cmd, data: cmd2.plugin.CommandFinalizationData) -> cmd2.plugin.CommandFinalizationData:
15
+ if self.in_script():
16
+ self.poutput("WE ARE IN SCRIPT")
17
+ return data
18
19
+ hook_app = HookApp()
20
+ out, err = run_cmd(hook_app, '')
21
+ expected = normalize('')
22
+ assert out == expected
0 commit comments