Skip to content

Commit 74bf6d0

Browse files
committed
add-end-to-end-test
1 parent e62c4ba commit 74bf6d0

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/test_completer.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2068,6 +2068,26 @@ def _(expected):
20682068
a_matcher.matcher_priority = 3
20692069
_(["completion_a"])
20702070

2071+
def test_private_attr_completions(self):
2072+
ip = get_ipython()
2073+
ip.user_ns["Test"] = type("Test", (), {"_test1": 1, "__test2": 2})
2074+
ip.user_ns["t"] = ip.user_ns["Test"]()
2075+
2076+
try:
2077+
with provisionalcompleter():
2078+
completions = list(ip.Completer.completions(text="t._", offset=3))
2079+
completion_texts = [c.text for c in completions]
2080+
2081+
assert (
2082+
"_test1" in completion_texts
2083+
), f"_test1 not found in {completion_texts}"
2084+
assert (
2085+
"__test2" in completion_texts
2086+
), f"__test2 not found in {completion_texts}"
2087+
finally:
2088+
del ip.user_ns["Test"]
2089+
del ip.user_ns["t"]
2090+
20712091

20722092
@pytest.mark.parametrize(
20732093
"use_jedi,evaluation",

0 commit comments

Comments
 (0)