diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2021-02-19 21:35:13 -0500 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2021-02-19 21:35:13 -0500 |
commit | 3e180a810e9c4b9d251c135667d1d150b0bbd0dd (patch) | |
tree | 03e49d5da86d40efa9118eccfd8bd4bbf3dcf86b /tests/test_completion.py | |
parent | 4c70bdb03d34c43f833bf77c441452cd402d0715 (diff) | |
parent | 06aaf962689840631325c70ea7e9056d176c7f67 (diff) | |
download | cmd2-git-3e180a810e9c4b9d251c135667d1d150b0bbd0dd.tar.gz |
Merge branch 'master' into black
# Conflicts:
# cmd2/__init__.py
# cmd2/argparse_completer.py
# cmd2/argparse_custom.py
# cmd2/cmd2.py
# cmd2/decorators.py
# cmd2/exceptions.py
# cmd2/utils.py
# examples/arg_decorators.py
# examples/argparse_completion.py
# examples/modular_commands_main.py
# tests/test_argparse_completer.py
# tests/test_argparse_custom.py
# tests/test_cmd2.py
# tests/test_completion.py
# tests/test_history.py
Diffstat (limited to 'tests/test_completion.py')
-rwxr-xr-x | tests/test_completion.py | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/tests/test_completion.py b/tests/test_completion.py index 4dcf5575..1a8e5c4d 100755 --- a/tests/test_completion.py +++ b/tests/test_completion.py @@ -69,15 +69,14 @@ class CompletionsExample(cmd2.Cmd): def __init__(self): cmd2.Cmd.__init__(self, multiline_commands=['test_multiline']) self.foo = 'bar' - self.add_settable( - utils.Settable('foo', str, description="a settable param", completer_method=CompletionsExample.complete_foo_val) - ) + self.add_settable(utils.Settable('foo', str, description="a settable param", + completer=CompletionsExample.complete_foo_val)) def do_test_basic(self, args): pass def complete_test_basic(self, text, line, begidx, endidx): - return utils.basic_complete(text, line, begidx, endidx, food_item_strs) + return self.basic_complete(text, line, begidx, endidx, food_item_strs) def do_test_delimited(self, args): pass @@ -90,7 +89,7 @@ class CompletionsExample(cmd2.Cmd): def complete_test_sort_key(self, text, line, begidx, endidx): num_strs = ['2', '11', '1'] - return utils.basic_complete(text, line, begidx, endidx, num_strs) + return self.basic_complete(text, line, begidx, endidx, num_strs) def do_test_raise_exception(self, args): pass @@ -102,7 +101,7 @@ class CompletionsExample(cmd2.Cmd): pass def complete_test_multiline(self, text, line, begidx, endidx): - return utils.basic_complete(text, line, begidx, endidx, sport_item_strs) + return self.basic_complete(text, line, begidx, endidx, sport_item_strs) def do_test_no_completer(self, args): """Completing this should result in completedefault() being called""" @@ -564,7 +563,7 @@ def test_basic_completion_single(cmd2_app): endidx = len(line) begidx = endidx - len(text) - assert utils.basic_complete(text, line, begidx, endidx, food_item_strs) == ['Pizza'] + assert cmd2_app.basic_complete(text, line, begidx, endidx, food_item_strs) == ['Pizza'] def test_basic_completion_multiple(cmd2_app): @@ -573,7 +572,7 @@ def test_basic_completion_multiple(cmd2_app): endidx = len(line) begidx = endidx - len(text) - matches = sorted(utils.basic_complete(text, line, begidx, endidx, food_item_strs)) + matches = sorted(cmd2_app.basic_complete(text, line, begidx, endidx, food_item_strs)) assert matches == sorted(food_item_strs) @@ -583,7 +582,7 @@ def test_basic_completion_nomatch(cmd2_app): endidx = len(line) begidx = endidx - len(text) - assert utils.basic_complete(text, line, begidx, endidx, food_item_strs) == [] + assert cmd2_app.basic_complete(text, line, begidx, endidx, food_item_strs) == [] def test_delimiter_completion(cmd2_app): @@ -914,10 +913,9 @@ def test_no_completer(cmd2_app): first_match = complete_tester(text, line, begidx, endidx, cmd2_app) assert first_match is not None and cmd2_app.completion_matches == expected - -def test_quote_as_command(cmd2_app): +def test_wordbreak_in_command(cmd2_app): text = '' - line = '" {}'.format(text) + line = '"{}'.format(text) endidx = len(line) begidx = endidx - len(text) @@ -1213,7 +1211,7 @@ class SubcommandsWithUnknownExample(cmd2.Cmd): @pytest.fixture def scu_app(): - """Declare test fixture for with_argparser_and_unknown_args""" + """Declare test fixture for with_argparser decorator""" app = SubcommandsWithUnknownExample() return app |