diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2019-05-07 21:20:11 -0400 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2019-05-07 21:20:11 -0400 |
commit | e52852be4d9270040d4fcb4eeabe2ca15521f48d (patch) | |
tree | 0c94818fca6e86de1c0d968ca1846f8d67792be5 /tests/test_autocompletion.py | |
parent | 358ff2b017aff098a82fb1f41dc021c850779daf (diff) | |
parent | 46f0aed0b66f45d08ef7fa8b16f787dc79ea32b1 (diff) | |
download | cmd2-git-e52852be4d9270040d4fcb4eeabe2ca15521f48d.tar.gz |
Merged master and resolved conflicts in CHANGELOG
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 |