mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-29 07:26:59 +08:00
Add and fix some async/await issues.
This commit is contained in:
19
test/normalizer_issue_files/allowed_syntax_python3.5.py
Normal file
19
test/normalizer_issue_files/allowed_syntax_python3.5.py
Normal file
@@ -0,0 +1,19 @@
|
||||
"""
|
||||
Mostly allowed syntax in Python 3.5.
|
||||
"""
|
||||
|
||||
|
||||
async def foo():
|
||||
yield 1
|
||||
await bar()
|
||||
#: E901
|
||||
yield from []
|
||||
|
||||
|
||||
# With decorator it's a different statement.
|
||||
@bla
|
||||
async def foo():
|
||||
yield 1
|
||||
await bar()
|
||||
#: E901
|
||||
yield from []
|
||||
@@ -59,8 +59,9 @@ def test_indentation_errors(code, positions):
|
||||
@pytest.mark.parametrize(
|
||||
'code', [
|
||||
# SyntaxError
|
||||
pytest.mark.skipif('sys.version_info < (2, 6)', '1 +'),
|
||||
pytest.mark.skipif('sys.version_info < (2, 6)', '?'),
|
||||
# Python 2.6 has a bit different error messages here, so skip it.
|
||||
pytest.mark.skipif('sys.version_info <= (2, 6)', '1 +'),
|
||||
pytest.mark.skipif('sys.version_info <= (2, 6)', '?'),
|
||||
dedent('''\
|
||||
for a in [1]:
|
||||
try:
|
||||
@@ -97,6 +98,7 @@ def test_python_exception_matches(code):
|
||||
# SyntaxError
|
||||
('async def bla():\n def x(): await bla()', '3.5'),
|
||||
('yield from []', '3.5'),
|
||||
('async def foo(): yield from []', '3.5'),
|
||||
]
|
||||
)
|
||||
def test_python_exception_matches_version(code, version):
|
||||
|
||||
Reference in New Issue
Block a user