summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_autocompletion.py19
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