diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2022-09-25 08:21:58 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-25 08:21:58 (GMT) |
commit | 6daff06fc26e6a9978a72cc6649783a8270058e2 (patch) | |
tree | 52b6e3d1429de995bc5dc80f7f7a59dec5d75d51 | |
parent | a386d1341c29b093ba496373934a4a58eb5dd342 (diff) | |
download | cpython-6daff06fc26e6a9978a72cc6649783a8270058e2.zip cpython-6daff06fc26e6a9978a72cc6649783a8270058e2.tar.gz cpython-6daff06fc26e6a9978a72cc6649783a8270058e2.tar.bz2 |
gh-94808: Coverage: Test uppercase string literal prefixes (GH-95925)
(cherry picked from commit f00383ec9bb9452fd9d5f5003f123e68fc4a71d8)
Co-authored-by: Michael Droettboom <mdboom@gmail.com>
-rw-r--r-- | Lib/test/test_string_literals.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_string_literals.py b/Lib/test/test_string_literals.py index 3a3830b..7247b7e 100644 --- a/Lib/test/test_string_literals.py +++ b/Lib/test/test_string_literals.py @@ -266,6 +266,13 @@ class TestLiterals(unittest.TestCase): self.assertRaises(SyntaxError, eval, """ bu'' """) self.assertRaises(SyntaxError, eval, """ ub'' """) + def test_uppercase_prefixes(self): + self.assertEqual(eval(""" B'x' """), b'x') + self.assertEqual(eval(r""" R'\x01' """), r'\x01') + self.assertEqual(eval(r""" BR'\x01' """), br'\x01') + self.assertEqual(eval(""" F'{1+1}' """), f'{1+1}') + self.assertEqual(eval(r""" U'\U0001d120' """), u'\U0001d120') + def check_encoding(self, encoding, extra=""): modname = "xx_" + encoding.replace("-", "_") fn = os.path.join(self.tmpdir, modname + ".py") |