mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-06 21:04:29 +08:00
Merge branch 'rm-2.6' of https://github.com/hugovk/parso
This commit is contained in:
@@ -4,8 +4,8 @@ import sys
|
||||
from textwrap import dedent
|
||||
|
||||
import pytest
|
||||
import sys
|
||||
|
||||
from parso._compatibility import py_version
|
||||
from parso.utils import split_lines, parse_version_string
|
||||
from parso.python.token import PythonTokenTypes
|
||||
from parso.python import tokenize
|
||||
@@ -137,7 +137,7 @@ def test_identifier_contains_unicode():
|
||||
''')
|
||||
token_list = _get_token_list(fundef)
|
||||
unicode_token = token_list[1]
|
||||
if py_version >= 30:
|
||||
if sys.version_info.major >= 3:
|
||||
assert unicode_token[0] == NAME
|
||||
else:
|
||||
# Unicode tokens in Python 2 seem to be identified as operators.
|
||||
@@ -185,19 +185,19 @@ def test_ur_literals():
|
||||
assert typ == NAME
|
||||
|
||||
check('u""')
|
||||
check('ur""', is_literal=not py_version >= 30)
|
||||
check('Ur""', is_literal=not py_version >= 30)
|
||||
check('UR""', is_literal=not py_version >= 30)
|
||||
check('ur""', is_literal=not sys.version_info.major >= 3)
|
||||
check('Ur""', is_literal=not sys.version_info.major >= 3)
|
||||
check('UR""', is_literal=not sys.version_info.major >= 3)
|
||||
check('bR""')
|
||||
# Starting with Python 3.3 this ordering is also possible.
|
||||
if py_version >= 33:
|
||||
if sys.version_info.major >= 3:
|
||||
check('Rb""')
|
||||
|
||||
# Starting with Python 3.6 format strings where introduced.
|
||||
check('fr""', is_literal=py_version >= 36)
|
||||
check('rF""', is_literal=py_version >= 36)
|
||||
check('f""', is_literal=py_version >= 36)
|
||||
check('F""', is_literal=py_version >= 36)
|
||||
check('fr""', is_literal=sys.version_info >= (3, 6))
|
||||
check('rF""', is_literal=sys.version_info >= (3, 6))
|
||||
check('f""', is_literal=sys.version_info >= (3, 6))
|
||||
check('F""', is_literal=sys.version_info >= (3, 6))
|
||||
|
||||
|
||||
def test_error_literal():
|
||||
|
||||
Reference in New Issue
Block a user