From 9d6ce4a5bd25742166cccd317cf9e497d1115eae Mon Sep 17 00:00:00 2001 From: Kevin Van Brunt Date: Mon, 6 May 2019 02:39:26 -0400 Subject: ACArgumentParser no longer prints complete help text when a parsing error occurs --- tests/test_autocompletion.py | 2 +- tests/test_cmd2.py | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'tests') diff --git a/tests/test_autocompletion.py b/tests/test_autocompletion.py index 8aeac6b1..a5dafd2d 100644 --- a/tests/test_autocompletion.py +++ b/tests/test_autocompletion.py @@ -152,7 +152,7 @@ def test_autocomp_flags_narg_max(cmd2_app): def test_autcomp_narg_beyond_max(cmd2_app): out, err = run_cmd(cmd2_app, 'suggest -t movie -d 3 4 5') - assert 'Error: unrecognized arguments: 5' in err[0] + assert 'Error: unrecognized arguments: 5' in err[1] def test_autocomp_subcmd_nested(cmd2_app): diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index 300e3ed9..37e8b60e 100644 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -82,8 +82,8 @@ def test_base_argparse_help(base_app): def test_base_invalid_option(base_app): out, err = run_cmd(base_app, 'set -z') - assert 'Error: unrecognized arguments: -z' in err[0] - assert out[0] == 'Usage: set [-h] [-a] [-l] [param] [value]' + assert err[0] == 'Usage: set [-h] [-a] [-l] [param] [value]' + assert 'Error: unrecognized arguments: -z' in err[1] def test_base_shortcuts(base_app): out, err = run_cmd(base_app, 'shortcuts') @@ -285,7 +285,7 @@ def test_pyscript_with_exception(base_app, request): def test_pyscript_requires_an_argument(base_app): out, err = run_cmd(base_app, "pyscript") - assert "the following arguments are required: script_path" in err[0] + assert "the following arguments are required: script_path" in err[1] def test_base_error(base_app): @@ -314,7 +314,7 @@ def test_load_with_empty_args(base_app): out, err = run_cmd(base_app, 'load') # The load command requires a file path argument, so we should get an error message - assert "the following arguments are required" in err[0] + assert "the following arguments are required" in err[1] assert base_app.cmdqueue == [] @@ -448,7 +448,7 @@ def test_base_relative_load(base_app, request): def test_relative_load_requires_an_argument(base_app): out, err = run_cmd(base_app, '_relative_load') - assert 'Error: the following arguments' in err[0] + assert 'Error: the following arguments' in err[1] assert base_app.cmdqueue == [] @@ -1590,7 +1590,7 @@ def test_alias_create(base_app): # Use the alias out, err = run_cmd(base_app, 'fake') - assert "the following arguments are required: script_path" in err[0] + assert "the following arguments are required: script_path" in err[1] # See a list of aliases out, err = run_cmd(base_app, 'alias list') @@ -1681,7 +1681,7 @@ def test_macro_create(base_app): # Use the macro out, err = run_cmd(base_app, 'fake') - assert "the following arguments are required: script_path" in err[0] + assert "the following arguments are required: script_path" in err[1] # See a list of macros out, err = run_cmd(base_app, 'macro list') -- cgit v1.2.1