diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-09-28 13:53:27 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-09-28 13:53:27 -0400 |
commit | 4b4b3ef1819dde1c6d1ea7a70bf67e805d23470d (patch) | |
tree | 1f39e0d9f1dd4327a3d54fc381901ba7b83ac6cd /tests | |
parent | 35e99b267c61ba38023fadfa6687785357c74aaf (diff) | |
parent | ed33f32b5924be3866c147bf8eaf088e65cd101d (diff) | |
download | cmd2-git-4b4b3ef1819dde1c6d1ea7a70bf67e805d23470d.tar.gz |
Merge branch 'macro' into argparse_conversion
Diffstat (limited to 'tests')
-rw-r--r-- | tests/conftest.py | 5 | ||||
-rw-r--r-- | tests/test_completion.py | 8 |
2 files changed, 6 insertions, 7 deletions
diff --git a/tests/conftest.py b/tests/conftest.py index 93348098..da7e8b08 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -160,9 +160,8 @@ def complete_tester(text: str, line: str, begidx: int, endidx: int, app) -> Opti def get_endidx(): return endidx + # Run the readline tab-completion function with readline mocks in place with mock.patch.object(readline, 'get_line_buffer', get_line): with mock.patch.object(readline, 'get_begidx', get_begidx): with mock.patch.object(readline, 'get_endidx', get_endidx): - # Run the readline tab-completion function with readline mocks in place - first_match = app.complete(text, 0) - return first_match + return app.complete(text, 0) diff --git a/tests/test_completion.py b/tests/test_completion.py index 8bf0cc02..b1ca80b8 100644 --- a/tests/test_completion.py +++ b/tests/test_completion.py @@ -101,8 +101,7 @@ def test_complete_empty_arg(cmd2_app): expected = sorted(cmd2_app.get_visible_commands()) first_match = complete_tester(text, line, begidx, endidx, cmd2_app) - assert first_match is not None and \ - cmd2_app.completion_matches == expected + assert first_match is not None and cmd2_app.completion_matches == expected def test_complete_bogus_command(cmd2_app): text = '' @@ -121,14 +120,15 @@ def test_complete_macro(base_app, request): # Macros do path completion test_dir = os.path.dirname(request.module.__file__) - text = os.path.join(test_dir, 'script.py') + text = os.path.join(test_dir, 's') line = 'fake {}'.format(text) endidx = len(line) begidx = endidx - len(text) + expected = [text + 'cript.py', text + 'cript.txt', text + 'cripts' + os.path.sep] first_match = complete_tester(text, line, begidx, endidx, base_app) - assert first_match == text + ' ' + assert first_match is not None and base_app.completion_matches def test_cmd2_command_completion_multiple(cmd2_app): |