Skip to content

Commit 150c2a5

Browse files
committed
Fix test_typing
1 parent 4e583e3 commit 150c2a5

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

tests/integration/test_typing.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"""
1313

1414

15-
def run_pyright(codefile):
15+
def run_pyright(codefile: str):
1616

1717
cmd = shlex.split(
1818
f"pyright {codefile}",
@@ -33,14 +33,14 @@ def run_pyright(codefile):
3333

3434

3535
def assert_pyright_output(
36-
codefile, expected_outputs=tuple(), expected_errors=tuple(), expected_status=0
36+
codefile: str, expected_outputs=tuple(), expected_errors=tuple(), expected_status=0
3737
):
3838
output, error, status = run_pyright(codefile)
3939
assert (
4040
status == expected_status
4141
), f"Status: {status}\nOutput: {output}\nError: {error}"
4242
for ex_out in expected_outputs:
43-
assert ex_out in output
43+
assert ex_out in output, f"Invalid output:\n {output}"
4444
for ex_err in expected_errors:
4545
assert ex_err in error
4646

@@ -54,7 +54,7 @@ def assert_pyright_output(
5454
{
5555
"expected_status": 1,
5656
"expected_outputs": [
57-
'Argument of type "Literal[4]" cannot be assigned to parameter "a_string" of type "str"'
57+
'Argument of type "Literal[4]" cannot be assigned to parameter "a_string" of type "str | None"'
5858
],
5959
},
6060
),
@@ -70,7 +70,7 @@ def assert_pyright_output(
7070
"expected_status": 1,
7171
"expected_outputs": [
7272
'Argument of type "Literal[\'\']" cannot be assigned to parameter "a_number" '
73-
'of type "int | float | Number"'
73+
'of type "int | float | Number | None"'
7474
],
7575
},
7676
),
@@ -104,7 +104,7 @@ def assert_pyright_output(
104104
"expected_status": 1,
105105
"expected_outputs": [
106106
'Argument of type "dict[Any, Any]" cannot be assigned to parameter "array_string" '
107-
'of type "List[str] | Tuple[Unknown, ...]"'
107+
'of type "Sequence[str] | Tuple[Unknown, ...] | None"'
108108
],
109109
},
110110
),
@@ -204,7 +204,7 @@ def assert_pyright_output(
204204
"expected_status": 1,
205205
"expected_outputs": [
206206
'Argument of type "tuple[Literal[1], Literal[2]]" cannot be assigned '
207-
'to parameter "a_tuple" of type "Tuple[int | float | Number, str]"'
207+
'to parameter "a_tuple" of type "Tuple[int | float | Number, str] | None"'
208208
],
209209
},
210210
),
@@ -224,14 +224,16 @@ def assert_pyright_output(
224224
"obj={}",
225225
{
226226
"expected_status": 1,
227-
"expected_outputs": ['"value" is required in "Obj"'],
227+
"expected_outputs": ['"dict[Any, Any]" is incompatible with "Obj"'],
228228
},
229229
),
230230
(
231231
"obj={'value': 'a', 'label': 1}",
232232
{
233233
"expected_status": 1,
234-
"expected_outputs": ['"Literal[1]" is incompatible with "str"'],
234+
"expected_outputs": [
235+
'"dict[str, str | int]" is incompatible with "Obj"'
236+
],
235237
},
236238
),
237239
(

0 commit comments

Comments
 (0)