diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_argparse.py | 6 | ||||
-rwxr-xr-x | tests/test_cmd2.py | 4 | ||||
-rwxr-xr-x | tests/test_completion.py | 2 | ||||
-rw-r--r-- | tests/test_transcript.py | 5 |
4 files changed, 9 insertions, 8 deletions
diff --git a/tests/test_argparse.py b/tests/test_argparse.py index daf43497..1334f9e3 100644 --- a/tests/test_argparse.py +++ b/tests/test_argparse.py @@ -92,7 +92,7 @@ class ArgparseApp(cmd2.Cmd): known_parser.add_argument('-p', '--piglatin', action='store_true', help='atinLay') known_parser.add_argument('-s', '--shout', action='store_true', help='N00B EMULATION MODE') known_parser.add_argument('-r', '--repeat', type=int, help='output [n] times') - @cmd2.with_argparser_and_unknown_args(known_parser) + @cmd2.with_argparser(known_parser, with_unknown_args=True) def do_speak(self, args, extra, *, keyword_arg: Optional[str] = None): """Repeat what you tell me to.""" words = [] @@ -112,11 +112,11 @@ class ArgparseApp(cmd2.Cmd): if keyword_arg is not None: print(keyword_arg) - @cmd2.with_argparser_and_unknown_args(argparse.ArgumentParser(), preserve_quotes=True) + @cmd2.with_argparser(argparse.ArgumentParser(), preserve_quotes=True, with_unknown_args=True) def do_test_argparse_with_list_quotes(self, args, extra): self.stdout.write('{}'.format(' '.join(extra))) - @cmd2.with_argparser_and_unknown_args(argparse.ArgumentParser(), ns_provider=namespace_provider) + @cmd2.with_argparser(argparse.ArgumentParser(), ns_provider=namespace_provider, with_unknown_args=True) def do_test_argparse_with_list_ns(self, args, extra): self.stdout.write('{}'.format(args.custom_stuff)) diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index bc0e0a94..8688e124 100755 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -1224,7 +1224,7 @@ def test_select_ctrl_c(outsim_app, monkeypatch, capsys): class HelpNoDocstringApp(cmd2.Cmd): greet_parser = argparse.ArgumentParser() greet_parser.add_argument('-s', '--shout', action="store_true", help="N00B EMULATION MODE") - @cmd2.with_argparser_and_unknown_args(greet_parser) + @cmd2.with_argparser(greet_parser, with_unknown_args=True) def do_greet(self, opts, arg): arg = ''.join(arg) if opts.shout: @@ -1268,7 +1268,7 @@ class MultilineApp(cmd2.Cmd): orate_parser = argparse.ArgumentParser() orate_parser.add_argument('-s', '--shout', action="store_true", help="N00B EMULATION MODE") - @cmd2.with_argparser_and_unknown_args(orate_parser) + @cmd2.with_argparser(orate_parser, with_unknown_args=True) def do_orate(self, opts, arg): arg = ''.join(arg) if opts.shout: diff --git a/tests/test_completion.py b/tests/test_completion.py index a380d43a..48a055d0 100755 --- a/tests/test_completion.py +++ b/tests/test_completion.py @@ -1132,7 +1132,7 @@ class SubcommandsWithUnknownExample(cmd2.Cmd): parser_sport = base_subparsers.add_parser('sport', help='sport help') sport_arg = parser_sport.add_argument('sport', help='Enter name of a sport', choices=sport_item_strs) - @cmd2.with_argparser_and_unknown_args(base_parser) + @cmd2.with_argparser(base_parser, with_unknown_args=True) def do_base(self, args): """Base command help""" func = getattr(args, 'func', None) diff --git a/tests/test_transcript.py b/tests/test_transcript.py index 69389b7f..55d60e18 100644 --- a/tests/test_transcript.py +++ b/tests/test_transcript.py @@ -41,7 +41,7 @@ class CmdLineApp(cmd2.Cmd): speak_parser.add_argument('-s', '--shout', action="store_true", help="N00B EMULATION MODE") speak_parser.add_argument('-r', '--repeat', type=int, help="output [n] times") - @cmd2.with_argparser_and_unknown_args(speak_parser) + @cmd2.with_argparser(speak_parser, with_unknown_args=True) def do_speak(self, opts, arg): """Repeats what you tell me to.""" arg = ' '.join(arg) @@ -61,7 +61,8 @@ class CmdLineApp(cmd2.Cmd): mumble_parser = argparse.ArgumentParser() mumble_parser.add_argument('-r', '--repeat', type=int, help="output [n] times") - @cmd2.with_argparser_and_unknown_args(mumble_parser) + + @cmd2.with_argparser(mumble_parser, with_unknown_args=True) def do_mumble(self, opts, arg): """Mumbles what you tell me to.""" repetitions = opts.repeat or 1 |