diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_argparse_completer.py | 14 | ||||
-rw-r--r-- | tests/test_completion.py | 6 |
2 files changed, 10 insertions, 10 deletions
diff --git a/tests/test_argparse_completer.py b/tests/test_argparse_completer.py index 4ad4c560..19ec551b 100644 --- a/tests/test_argparse_completer.py +++ b/tests/test_argparse_completer.py @@ -263,7 +263,7 @@ def test_complete_help(ac_app, command, text, completions): else: assert first_match is None - assert ac_app.completion_matches == sorted(completions, key=ac_app.matches_sort_key) + assert ac_app.completion_matches == sorted(completions, key=ac_app.default_sort_key) @pytest.mark.parametrize('command_and_args, text, completions', [ @@ -320,7 +320,7 @@ def test_autcomp_flag_completion(ac_app, command_and_args, text, completions): else: assert first_match is None - assert ac_app.completion_matches == sorted(completions, key=ac_app.matches_sort_key) + assert ac_app.completion_matches == sorted(completions, key=ac_app.default_sort_key) @pytest.mark.parametrize('flag, text, completions', [ @@ -346,7 +346,7 @@ def test_autocomp_flag_choices_completion(ac_app, flag, text, completions): else: assert first_match is None - assert ac_app.completion_matches == sorted(completions, key=ac_app.matches_sort_key) + assert ac_app.completion_matches == sorted(completions, key=ac_app.default_sort_key) @pytest.mark.parametrize('pos, text, completions', [ @@ -369,7 +369,7 @@ def test_autocomp_positional_choices_completion(ac_app, pos, text, completions): else: assert first_match is None - assert ac_app.completion_matches == sorted(completions, key=ac_app.matches_sort_key) + assert ac_app.completion_matches == sorted(completions, key=ac_app.default_sort_key) @pytest.mark.parametrize('flag, text, completions', [ @@ -389,7 +389,7 @@ def test_autocomp_flag_completers(ac_app, flag, text, completions): else: assert first_match is None - assert ac_app.completion_matches == sorted(completions, key=ac_app.matches_sort_key) + assert ac_app.completion_matches == sorted(completions, key=ac_app.default_sort_key) @pytest.mark.parametrize('pos, text, completions', [ @@ -410,7 +410,7 @@ def test_autocomp_positional_completers(ac_app, pos, text, completions): else: assert first_match is None - assert ac_app.completion_matches == sorted(completions, key=ac_app.matches_sort_key) + assert ac_app.completion_matches == sorted(completions, key=ac_app.default_sort_key) def test_autocomp_blank_token(ac_app): @@ -548,7 +548,7 @@ def test_autcomp_nargs(ac_app, args, completions): else: assert first_match is None - assert ac_app.completion_matches == sorted(completions, key=ac_app.matches_sort_key) + assert ac_app.completion_matches == sorted(completions, key=ac_app.default_sort_key) @pytest.mark.parametrize('command_and_args, text, is_error', [ diff --git a/tests/test_completion.py b/tests/test_completion.py index 1411cc49..3cee1955 100644 --- a/tests/test_completion.py +++ b/tests/test_completion.py @@ -174,20 +174,20 @@ def test_complete_macro(base_app, request): assert first_match is not None and base_app.completion_matches == expected -def test_matches_sort_key(cmd2_app): +def test_default_sort_key(cmd2_app): text = '' line = 'test_sort_key {}'.format(text) endidx = len(line) begidx = endidx - len(text) # First do alphabetical sorting - cmd2_app.matches_sort_key = cmd2.cmd2.ALPHABETICAL_SORT_KEY + cmd2_app.default_sort_key = cmd2.cmd2.ALPHABETICAL_SORT_KEY expected = ['1', '11', '2'] first_match = complete_tester(text, line, begidx, endidx, cmd2_app) assert first_match is not None and cmd2_app.completion_matches == expected # Now switch to natural sorting - cmd2_app.matches_sort_key = cmd2.cmd2.NATURAL_SORT_KEY + cmd2_app.default_sort_key = cmd2.cmd2.NATURAL_SORT_KEY expected = ['1', '2', '11'] first_match = complete_tester(text, line, begidx, endidx, cmd2_app) assert first_match is not None and cmd2_app.completion_matches == expected |