Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 28d3ccd

Browse files
committed
Add more tests
1 parent fa6d7f7 commit 28d3ccd

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

tests/test_completer.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -424,11 +424,17 @@ def test_local_file_completions(self):
424424
c = ip.complete(prefix)[1]
425425
self.assertEqual(c, names)
426426

427-
# Now check with a function call
428-
cmd = 'a = f("%s' % prefix
429-
c = ip.complete(prefix, cmd)[1]
430-
comp = {prefix + s for s in suffixes}
431-
self.assertTrue(comp.issubset(set(c)))
427+
test_cases = {
428+
"function call": 'a = f("',
429+
"shell bang": "!ls ",
430+
"ls magic": r"%ls ",
431+
"alias ls": "ls ",
432+
}
433+
for name, code in test_cases.items():
434+
cmd = f"{code}{prefix}"
435+
c = ip.complete(prefix, cmd)[1]
436+
comp = {prefix + s for s in suffixes}
437+
self.assertTrue(comp.issubset(set(c)), msg=f"completes in {name}")
432438

433439
def test_quoted_file_completions(self):
434440
ip = get_ipython()
@@ -2678,6 +2684,7 @@ def test_completion_in_cli_context(line, expected, expected_after_assignment):
26782684
finally:
26792685
ip.user_ns.pop("test_alias", None)
26802686

2687+
26812688
@pytest.mark.xfail(reason="Completion context not yet supported")
26822689
@pytest.mark.parametrize(
26832690
"line, expected",

0 commit comments

Comments
 (0)