Skip to content

Commit 2a6cdf2

Browse files
committed
use test_alias as test is already on user_ns
1 parent 2314ec5 commit 2a6cdf2

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

tests/test_completer.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2651,18 +2651,17 @@ def test_completion_context(line, expected):
26512651
@pytest.mark.parametrize(
26522652
"line,expected,expected_after_assignment",
26532653
[
2654-
("test file", True, False), # overshadowed by variable
2655-
("test .", True, False),
2656-
("test file.", True, False),
2657-
("%test .file.ext", True, True), # magic, not affected by variable
2658-
("!test file.", True, True), # bang, not affected by variable
2654+
("test_alias file", True, False), # overshadowed by variable
2655+
("test_alias .", True, False),
2656+
("test_alias file.", True, False),
2657+
("%test_alias .file.ext", True, True), # magic, not affected by variable
2658+
("!test_alias file.", True, True), # bang, not affected by variable
26592659
],
26602660
)
26612661
def test_completion_in_cli_context(line, expected, expected_after_assignment):
26622662
"""Test completion context with and without variable overshadowing"""
26632663
ip = get_ipython()
2664-
ip.run_cell("alias test echo test")
2665-
print("\nDEBUG:\n", ip.alias_manager.aliases)
2664+
ip.run_cell("alias test_alias echo test_alias")
26662665
get_context = ip.Completer._is_completing_in_cli_context
26672666

26682667
# Normal case
@@ -2671,13 +2670,13 @@ def test_completion_in_cli_context(line, expected, expected_after_assignment):
26712670

26722671
# Test with alias assigned as a variable
26732672
try:
2674-
ip.user_ns["test"] = "some_value"
2673+
ip.user_ns["test_alias"] = "some_value"
26752674
result_after_assignment = get_context(line)
26762675
assert (
26772676
result_after_assignment == expected_after_assignment
26782677
), f"Failed after assigning 'ls' as a variable for input: '{line}'"
26792678
finally:
2680-
ip.user_ns.pop("test", None)
2679+
ip.user_ns.pop("test_alias", None)
26812680

26822681
@pytest.mark.xfail(reason="Completion context not yet supported")
26832682
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)