Skip to content

Commit 07e4612

Browse files
authored
Test for type comment on last line of assignment (#21333)
Depends on mypyc/ast_serialize#57
1 parent c840a3b commit 07e4612

4 files changed

Lines changed: 14 additions & 3 deletions

File tree

mypy-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ mypy_extensions>=1.0.0
66
pathspec>=1.0.0
77
tomli>=1.1.0; python_version<'3.11'
88
librt>=0.9.0; platform_python_implementation != 'PyPy'
9-
ast-serialize>=0.2.0,<1.0.0
9+
ast-serialize>=0.2.1,<1.0.0

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ dependencies = [
5656
"pathspec>=1.0.0",
5757
"tomli>=1.1.0; python_version<'3.11'",
5858
"librt>=0.9.0; platform_python_implementation != 'PyPy'",
59-
"ast-serialize>=0.2.0,<1.0.0",
59+
"ast-serialize>=0.2.1,<1.0.0",
6060
]
6161
dynamic = ["version"]
6262

test-data/unit/native-parser.test

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3275,3 +3275,14 @@ MypyFile:1(
32753275
TypeParam(
32763276
*Ts)
32773277
PassStmt:4()))
3278+
3279+
[case testTypeCommentLastLine]
3280+
d = [
3281+
# Placeholder for items
3282+
] # type: list[int]
3283+
[out]
3284+
MypyFile:1(
3285+
AssignmentStmt:1(
3286+
NameExpr(d)
3287+
ListExpr:1()
3288+
list?[int?]))

test-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# pip-compile --allow-unsafe --output-file=test-requirements.txt --strip-extras test-requirements.in
66
#
7-
ast-serialize==0.2.0
7+
ast-serialize==0.2.1
88
# via -r test-requirements.in
99
attrs==25.4.0
1010
# via -r test-requirements.in

0 commit comments

Comments
 (0)