From 67aa13c732b331e700c8bd16c77fabfe6c90c75c Mon Sep 17 00:00:00 2001 From: Todd Leonhardt Date: Tue, 25 Sep 2018 00:10:13 -0400 Subject: Deleted the hook methods which were deprecated in the previous release The following methods of cmd2.Cmd have been deleted: - preparse - postparsing_precmd - postparsing_postcmd The new application lifecycle hook framework allows for registering callbacks to be called at various points in the application lifecycle and is more powerful and flexible than the old system of fixed hook methods. --- tests/test_plugin.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tests/test_plugin.py') diff --git a/tests/test_plugin.py b/tests/test_plugin.py index 20f2f32c..81dd7683 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -51,10 +51,10 @@ class Plugin: # preparse hook # ### - def preparse(self, line: str) -> str: + def preparse(self, data: cmd2.plugin.PostparsingData) -> cmd2.plugin.PostparsingData: """Preparsing hook""" self.called_preparse += 1 - return line + return data ### # @@ -322,6 +322,7 @@ def test_postloop_hooks(capsys): ### def test_preparse(capsys): app = PluggedApp() + app.register_postparsing_hook(app.preparse) app.onecmd_plus_hooks('say hello') out, err = capsys.readouterr() assert out == 'hello\n' -- cgit v1.2.1