diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2019-05-07 21:11:44 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-07 21:11:44 -0400 |
commit | 46f0aed0b66f45d08ef7fa8b16f787dc79ea32b1 (patch) | |
tree | 02ba0cea776cb23651353314e572f74e543e8acd /tests/test_autocompletion.py | |
parent | 673d8a1bebcada7f0182758acfe7f65637113286 (diff) | |
parent | 47999ffd250eab4875747b32af2e7b7505212d67 (diff) | |
download | cmd2-git-46f0aed0b66f45d08ef7fa8b16f787dc79ea32b1.tar.gz |
Merge pull request #671 from python-cmd2/completion_exceptions
Improved tab completion error feedback
Diffstat (limited to 'tests/test_autocompletion.py')
-rw-r--r-- | tests/test_autocompletion.py | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/tests/test_autocompletion.py b/tests/test_autocompletion.py index a5dafd2d..005eee81 100644 --- a/tests/test_autocompletion.py +++ b/tests/test_autocompletion.py @@ -229,7 +229,7 @@ def test_autocomp_subcmd_flag_comp_list_attr(cmd2_app): assert first_match is not None and first_match == '"Gareth Edwards' -def test_autcomp_pos_consumed(cmd2_app): +def test_autocomp_pos_consumed(cmd2_app): text = '' line = 'library movie add SW_EP01 {}'.format(text) endidx = len(line) @@ -239,7 +239,7 @@ def test_autcomp_pos_consumed(cmd2_app): assert first_match is None -def test_autcomp_pos_after_flag(cmd2_app): +def test_autocomp_pos_after_flag(cmd2_app): text = 'Joh' line = 'video movies add -d "George Lucas" -- "Han Solo" PG "Emilia Clarke" "{}'.format(text) endidx = len(line) @@ -250,7 +250,7 @@ def test_autcomp_pos_after_flag(cmd2_app): cmd2_app.completion_matches == ['John Boyega" '] -def test_autcomp_custom_func_list_arg(cmd2_app): +def test_autocomp_custom_func_list_arg(cmd2_app): text = 'SW_' line = 'library show add {}'.format(text) endidx = len(line) @@ -261,7 +261,7 @@ def test_autcomp_custom_func_list_arg(cmd2_app): cmd2_app.completion_matches == ['SW_CW', 'SW_REB', 'SW_TCW'] -def test_autcomp_custom_func_list_and_dict_arg(cmd2_app): +def test_autocomp_custom_func_list_and_dict_arg(cmd2_app): text = '' line = 'library show add SW_REB {}'.format(text) endidx = len(line) @@ -272,6 +272,17 @@ def test_autcomp_custom_func_list_and_dict_arg(cmd2_app): cmd2_app.completion_matches == ['S01E02', 'S01E03', 'S02E01', 'S02E03'] +def test_autocomp_custom_func_dict_arg(cmd2_app): + text = '/home/user/' + line = 'video movies load {}'.format(text) + endidx = len(line) + begidx = endidx - len(text) + + first_match = complete_tester(text, line, begidx, endidx, cmd2_app) + assert first_match is not None and \ + cmd2_app.completion_matches == ['/home/user/another.db', '/home/user/file space.db', '/home/user/file.db'] + + def test_argparse_remainder_flag_completion(cmd2_app): import cmd2 import argparse |