diff options
Diffstat (limited to 'tests/test_completion.py')
-rw-r--r-- | tests/test_completion.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/test_completion.py b/tests/test_completion.py index 35d014cd..daeb94bf 100644 --- a/tests/test_completion.py +++ b/tests/test_completion.py @@ -723,10 +723,11 @@ class SubcommandsExample(cmd2.Cmd): @cmd2.with_argparser(base_parser) def do_base(self, args): """Base command help""" - try: - # Call whatever sub-command function was selected - args.func(self, args) - except AttributeError: + func = getattr(args, 'func', None) + if func is not None: + # Call whatever subcommand function was selected + func(self, args) + else: # No sub-command was provided, so as called self.do_help('base') |