diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2022-09-25 08:58:50 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-25 08:58:50 (GMT) |
commit | 00713a8b3a7f498443225bf35d123b84d526b92d (patch) | |
tree | fad2e394f4557f61656ae251f281d9ff477e0cd5 | |
parent | f29c88de52f8f88e63a1b4f8c9f22bf464d7f7c6 (diff) | |
download | cpython-00713a8b3a7f498443225bf35d123b84d526b92d.zip cpython-00713a8b3a7f498443225bf35d123b84d526b92d.tar.gz cpython-00713a8b3a7f498443225bf35d123b84d526b92d.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 7231970..f3d5f33 100644 --- a/Lib/test/test_string_literals.py +++ b/Lib/test/test_string_literals.py @@ -213,6 +213,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") |