Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changelog.d/4725.test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add first intellisense test
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ tests = [
"pytest-cov==7.0.0",
"pytest-mock==3.15.1",
"pytest-xdist==3.8.0",
"pyfakefs==5.10.1"
"pyfakefs==5.10.1",
"jedi==0.19.2",
]
docs = [
"Sphinx==8.1.3",
Expand Down
35 changes: 35 additions & 0 deletions tests/test_intellisense.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import jedi


def test_settings_file_read_case():
prefix = """import ansys.fluent.core as pyfluent
solver = pyfluent.launch_fluent()
"""
path = "solver.settings."
filename = "example.py"
line = 4
script = jedi.Script(code=f"{prefix}\n{path}", path=filename)
completions = script.complete(line=line, column=len(path))
file = next((c for c in completions if c.name == "file"), None)
assert file is not None
assert file.name == "file"
assert file.docstring() == "file(*args, **kwargs)" # not correct

path += "file."
script = jedi.Script(code=f"{prefix}\n{path}", path=filename)
completions = script.complete(line=line, column=len(path))
read_case = next((c for c in completions if c.name == "read_case"), None)
assert read_case is not None
assert read_case.name == "read_case"
assert (
read_case.docstring()
== "read_case(file_name: str, pdf_file_name: str)\n\n'read_case' command."
)

path += "read_case("
script = jedi.Script(code=f"{prefix}\n{path}", path=filename)
completions = script.complete(line=line, column=len(path))
file_name = next((c for c in completions if c.name == "file_name="), None)
assert file_name is not None
assert file_name.name == "file_name="
assert file_name.docstring() == "" # not correct