mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-16 01:17:13 +08:00
Remove some Python 3.5/3.4 references
This commit is contained in:
@@ -1,7 +1,3 @@
|
|||||||
"""
|
|
||||||
To ensure compatibility from Python ``2.7`` - ``3.3``, a module has been
|
|
||||||
created. Clearly there is huge need to use conforming syntax.
|
|
||||||
"""
|
|
||||||
import platform
|
import platform
|
||||||
|
|
||||||
is_pypy = platform.python_implementation() == 'PyPy'
|
is_pypy = platform.python_implementation() == 'PyPy'
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ A list of syntax/indentation errors I've encountered in CPython.
|
|||||||
|
|
||||||
# Just ignore this one, newer versions will not be affected anymore and
|
# Just ignore this one, newer versions will not be affected anymore and
|
||||||
# it's a limit of 2^16 - 1.
|
# it's a limit of 2^16 - 1.
|
||||||
"too many annotations" # Only python 3.0 - 3.5, 3.6 is not affected.
|
|
||||||
|
|
||||||
# Python/ast.c
|
# Python/ast.c
|
||||||
# used with_item exprlist expr_stmt
|
# used with_item exprlist expr_stmt
|
||||||
@@ -54,8 +53,8 @@ A list of syntax/indentation errors I've encountered in CPython.
|
|||||||
"iterable unpacking cannot be used in comprehension" # [*[] for a in [1]]
|
"iterable unpacking cannot be used in comprehension" # [*[] for a in [1]]
|
||||||
"dict unpacking cannot be used in dict comprehension" # {**{} for a in [1]}
|
"dict unpacking cannot be used in dict comprehension" # {**{} for a in [1]}
|
||||||
"Generator expression must be parenthesized if not sole argument" # foo(x for x in [], b)
|
"Generator expression must be parenthesized if not sole argument" # foo(x for x in [], b)
|
||||||
"positional argument follows keyword argument unpacking" # f(**x, y) >= 3.5
|
"positional argument follows keyword argument unpacking" # f(**x, y)
|
||||||
"positional argument follows keyword argument" # f(x=2, y) >= 3.5
|
"positional argument follows keyword argument" # f(x=2, y)
|
||||||
"iterable argument unpacking follows keyword argument unpacking" # foo(**kwargs, *args)
|
"iterable argument unpacking follows keyword argument unpacking" # foo(**kwargs, *args)
|
||||||
"lambda cannot contain assignment" # f(lambda: 1=1)
|
"lambda cannot contain assignment" # f(lambda: 1=1)
|
||||||
"keyword can't be an expression" # f(+x=1)
|
"keyword can't be an expression" # f(+x=1)
|
||||||
@@ -167,10 +166,3 @@ A list of syntax/indentation errors I've encountered in CPython.
|
|||||||
E_OVERFLOW: "expression too long"
|
E_OVERFLOW: "expression too long"
|
||||||
E_DECODE: "unknown decode error"
|
E_DECODE: "unknown decode error"
|
||||||
E_BADSINGLE: "multiple statements found while compiling a single statement"
|
E_BADSINGLE: "multiple statements found while compiling a single statement"
|
||||||
|
|
||||||
|
|
||||||
Version specific:
|
|
||||||
Python 3.5:
|
|
||||||
'yield' inside async function
|
|
||||||
Python 3.4:
|
|
||||||
can use starred expression only as assignment target
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from textwrap import dedent
|
from textwrap import dedent
|
||||||
import logging
|
import logging
|
||||||
import sys
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
@@ -1267,7 +1266,6 @@ def test_some_weird_removals(differ):
|
|||||||
differ.parse(code1, copies=1)
|
differ.parse(code1, copies=1)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(sys.version_info < (3, 5), reason="Async starts working in 3.5")
|
|
||||||
def test_async_copy(differ):
|
def test_async_copy(differ):
|
||||||
code1 = dedent('''\
|
code1 = dedent('''\
|
||||||
async def main():
|
async def main():
|
||||||
|
|||||||
@@ -123,10 +123,6 @@ def _get_actual_exception(code):
|
|||||||
elif wanted == 'SyntaxError: assignment to keyword':
|
elif wanted == 'SyntaxError: assignment to keyword':
|
||||||
return [wanted, "SyntaxError: can't assign to keyword",
|
return [wanted, "SyntaxError: can't assign to keyword",
|
||||||
'SyntaxError: cannot assign to __debug__'], line_nr
|
'SyntaxError: cannot assign to __debug__'], line_nr
|
||||||
elif wanted == 'SyntaxError: can use starred expression only as assignment target':
|
|
||||||
# Python 3.4/3.4 have a bit of a different warning than 3.5/3.6 in
|
|
||||||
# certain places. But in others this error makes sense.
|
|
||||||
return [wanted, "SyntaxError: can't use starred expression here"], line_nr
|
|
||||||
elif wanted == 'SyntaxError: f-string: unterminated string':
|
elif wanted == 'SyntaxError: f-string: unterminated string':
|
||||||
wanted = 'SyntaxError: EOL while scanning string literal'
|
wanted = 'SyntaxError: EOL while scanning string literal'
|
||||||
elif wanted == 'SyntaxError: f-string expression part cannot include a backslash':
|
elif wanted == 'SyntaxError: f-string expression part cannot include a backslash':
|
||||||
|
|||||||
Reference in New Issue
Block a user