Fix a test

This commit is contained in:
Dave Halter
2018-04-05 00:45:23 +02:00
parent 56b3e2cdc8
commit 7c7f4f4e54

View File

@@ -7,7 +7,8 @@ import pytest
from parso._compatibility import py_version from parso._compatibility import py_version
from parso.utils import split_lines, parse_version_string from parso.utils import split_lines, parse_version_string
from parso.python.token import ( from parso.python.token import (
NAME, NEWLINE, STRING, INDENT, DEDENT, ERRORTOKEN, ENDMARKER, ERROR_DEDENT) NAME, NEWLINE, STRING, INDENT, DEDENT, ERRORTOKEN, ENDMARKER, ERROR_DEDENT,
FSTRING_START)
from parso.python import tokenize from parso.python import tokenize
from parso import parse from parso import parse
from parso.python.tokenize import PythonToken from parso.python.tokenize import PythonToken
@@ -162,8 +163,9 @@ def test_ur_literals():
token_list = _get_token_list(literal) token_list = _get_token_list(literal)
typ, result_literal, _, _ = token_list[0] typ, result_literal, _, _ = token_list[0]
if is_literal: if is_literal:
assert typ == STRING if typ != FSTRING_START:
assert result_literal == literal assert typ == STRING
assert result_literal == literal
else: else:
assert typ == NAME assert typ == NAME
@@ -175,6 +177,7 @@ def test_ur_literals():
# Starting with Python 3.3 this ordering is also possible. # Starting with Python 3.3 this ordering is also possible.
if py_version >= 33: if py_version >= 33:
check('Rb""') check('Rb""')
# Starting with Python 3.6 format strings where introduced. # Starting with Python 3.6 format strings where introduced.
check('fr""', is_literal=py_version >= 36) check('fr""', is_literal=py_version >= 36)
check('rF""', is_literal=py_version >= 36) check('rF""', is_literal=py_version >= 36)