diff options
author | Ćukasz Langa <lukasz@langa.pl> | 2017-05-22 22:19:09 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-22 22:19:09 (GMT) |
commit | 0c4aca54dcf0c54f299c78aa71fe8f48ff04f9d9 (patch) | |
tree | d004bb0e04c9c3381e33db4477bb4096aa68dbcd /Lib/lib2to3/tests | |
parent | 7bac69d7f141291b3cfc2fc39c5f3aa603202fe6 (diff) | |
download | cpython-0c4aca54dcf0c54f299c78aa71fe8f48ff04f9d9.zip cpython-0c4aca54dcf0c54f299c78aa71fe8f48ff04f9d9.tar.gz cpython-0c4aca54dcf0c54f299c78aa71fe8f48ff04f9d9.tar.bz2 |
Make rb'' strings work in lib2to3 (#1724)
This partially solves bpo-23894.
Diffstat (limited to 'Lib/lib2to3/tests')
-rw-r--r-- | Lib/lib2to3/tests/test_parser.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Lib/lib2to3/tests/test_parser.py b/Lib/lib2to3/tests/test_parser.py index 9a969e8..c79611d 100644 --- a/Lib/lib2to3/tests/test_parser.py +++ b/Lib/lib2to3/tests/test_parser.py @@ -320,6 +320,7 @@ class TestVarAnnotations(GrammarTest): def test_6(self): self.validate("lst: List[int] = []") + class TestExcept(GrammarTest): def test_new(self): s = """ @@ -338,6 +339,26 @@ class TestExcept(GrammarTest): self.validate(s) +class TestStringLiterals(GrammarTest): + prefixes = ("'", '"', + "r'", 'r"', "R'", 'R"', + "u'", 'u"', "U'", 'U"', + "b'", 'b"', "B'", 'B"', + "ur'", 'ur"', "Ur'", 'Ur"', + "uR'", 'uR"', "UR'", 'UR"', + "br'", 'br"', "Br'", 'Br"', + "bR'", 'bR"', "BR'", 'BR"', + "rb'", 'rb"', "Rb'", 'Rb"', + "rB'", 'rB"', "RB'", 'RB"',) + + def test_lit(self): + for pre in self.prefixes: + single = "{p}spamspamspam{s}".format(p=pre, s=pre[-1]) + self.validate(single) + triple = "{p}{s}{s}eggs{s}{s}{s}".format(p=pre, s=pre[-1]) + self.validate(triple) + + # Adapted from Python 3's Lib/test/test_grammar.py:GrammarTests.testAtoms class TestSetLiteral(GrammarTest): def test_1(self): |