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

Skip to content

Commit 72cac58

Browse files
committed
add-tests
1 parent afa48d4 commit 72cac58

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

tests/test_completer.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2121,6 +2121,14 @@ def test_undefined_variables(use_jedi, evaluation, code, insert_text):
21212121
" return 1.1",
21222122
"my_test().",
21232123
]
2124+
),
2125+
"\n".join(
2126+
[
2127+
"class MyClass():",
2128+
" b: list[str]",
2129+
"x = MyClass()",
2130+
"x.b[0].",
2131+
]
21242132
)
21252133
],
21262134
)
@@ -2129,12 +2137,13 @@ def test_no_file_completions_in_attr_access(code):
21292137
with TemporaryWorkingDirectory():
21302138
open(".hidden", "w", encoding="utf-8").close()
21312139
offset = len(code)
2132-
with provisionalcompleter():
2133-
completions = list(ip.Completer.completions(text=code, offset=offset))
2134-
matches = [c for c in completions if c.text.lstrip(".") == "hidden"]
2135-
assert (
2136-
len(matches) == 0
2137-
), f"File '.hidden' should not appear in attribute completion"
2140+
for use_jedi in (True, False):
2141+
with provisionalcompleter(), jedi_status(use_jedi):
2142+
completions = list(ip.Completer.completions(text=code, offset=offset))
2143+
matches = [c for c in completions if c.text.lstrip(".") == "hidden"]
2144+
assert (
2145+
len(matches) == 0
2146+
), f"File '.hidden' should not appear in attribute completion"
21382147

21392148

21402149
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)