File tree 2 files changed +15
-13
lines changed 2 files changed +15
-13
lines changed Original file line number Diff line number Diff line change 1
1
RELEASE_TYPE: patch
2
2
3
- Updated the type annotations for :func: `@given <hypothesis.given> ` so that
4
- type-checkers will raise on mixed positional and keyword arguments.
3
+ This patch updates the type annotations for :func: `@given <hypothesis.given> `
4
+ so that type-checkers will warn on mixed positional and keyword arguments,
5
+ as well as fixing :issue: `3296 `.
Original file line number Diff line number Diff line change @@ -78,20 +78,17 @@ def test_pyright_raises_for_mixed_pos_kwargs_in_given(tmp_path: Path):
78
78
from hypothesis import given
79
79
from hypothesis.strategies import text
80
80
81
- @given(text(), x=text()) # type: ignore
82
- def test_bar(x):
83
- ...
81
+ @given(text(), x=text())
82
+ def test_bar(x: str ):
83
+ pass
84
84
"""
85
85
)
86
86
)
87
- _write_config (
88
- tmp_path ,
89
- {
90
- "typeCheckingMode" : "strict" ,
91
- "reportUnnecessaryTypeIgnoreComment" : "true" ,
92
- },
87
+ _write_config (tmp_path , {"typeCheckingMode" : "strict" })
88
+ assert any (
89
+ e ["message" ].startswith ('No overloads for "given" match the provided arguments' )
90
+ for e in _get_pyright_errors (file )
93
91
)
94
- assert _get_pyright_errors (file ) == []
95
92
96
93
97
94
# ---------- Helpers for running pyright ---------- #
@@ -105,7 +102,11 @@ def _get_pyright_output(file: Path) -> dict[str, Any]:
105
102
text = True ,
106
103
capture_output = True ,
107
104
)
108
- return json .loads (proc .stdout )
105
+ try :
106
+ return json .loads (proc .stdout )
107
+ except Exception :
108
+ print (proc .stdout )
109
+ raise
109
110
110
111
111
112
def _get_pyright_errors (file : Path ) -> list [dict [str , Any ]]:
You can’t perform that action at this time.
0 commit comments