Skip to content

Commit 0930f9e

Browse files
committed
add pyright tests
1 parent 6752293 commit 0930f9e

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

whole-repo-tests/test_pyright.py

+40-1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,45 @@ def test_bar(x: str):
5555
assert _get_pyright_errors(file) == []
5656

5757

58+
def test_pyright_issue_3296(tmp_path: Path):
59+
file = tmp_path / "test.py"
60+
file.write_text(
61+
textwrap.dedent(
62+
"""
63+
from hypothesis.strategies import lists, integers
64+
65+
reveal_type(lists(integers()).map(sorted), expected_text="SearchStrategy[list[int]]")
66+
"""
67+
)
68+
)
69+
_write_config(tmp_path, {"typeCheckingMode": "strict"})
70+
assert _get_pyright_errors(file) == []
71+
72+
73+
def test_pyright_raises_for_mixed_pos_kwargs_in_given(tmp_path: Path):
74+
file = tmp_path / "test.py"
75+
file.write_text(
76+
textwrap.dedent(
77+
"""
78+
from hypothesis import given
79+
from hypothesis.strategies import text
80+
81+
@given(text(), x=text()) # type: ignore
82+
def test_bar(x):
83+
...
84+
"""
85+
)
86+
)
87+
_write_config(
88+
tmp_path,
89+
{
90+
"typeCheckingMode": "strict",
91+
"reportUnnecessaryTypeIgnoreComment": "true",
92+
},
93+
)
94+
assert _get_pyright_errors(file) == []
95+
96+
5897
# ---------- Helpers for running pyright ---------- #
5998

6099

@@ -63,7 +102,7 @@ def _get_pyright_output(file: Path) -> dict[str, Any]:
63102
[tool_path("pyright"), "--outputjson"],
64103
cwd=file.parent,
65104
encoding="utf-8",
66-
universal_newlines=True,
105+
text=True,
67106
capture_output=True,
68107
)
69108
return json.loads(proc.stdout)

0 commit comments

Comments
 (0)