Skip to content

Commit 5ab5fe8

Browse files
kmikedavidfritzsche
authored andcommitted
test for async def parsing
1 parent bbe54a7 commit 5ab5fe8

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/test_parser.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,22 @@ def test_mypy_bar():
9191
monkeypatch.setattr(sys, "version_info", (3, 7, 5))
9292
config = Mock(spec=Config)
9393
parse_file(str(path), config)
94+
95+
96+
def test_parse_async(tmp_path):
97+
path = tmp_path / "test_async.mypy-testing"
98+
path.write_text(dedent(
99+
r"""
100+
import pytest
101+
102+
@pytest.mark.mypy_testing
103+
async def mypy_test_invalid_assginment():
104+
foo = "abc"
105+
foo = 123 # E: Incompatible types in assignment (expression has type "int", variable has type "str")
106+
"""
107+
))
108+
config = Mock(spec=Config)
109+
result = parse_file(str(path), config)
110+
assert len(result.items) == 1
111+
item = result.items[0]
112+
assert item.name == "mypy_test_invalid_assginment"

0 commit comments

Comments
 (0)