Skip to content

Commit

Permalink
pythongh-94808: Coverage: Test uppercase string literal prefixes (pyt…
Browse files Browse the repository at this point in the history
  • Loading branch information
mdboom authored Sep 24, 2022
1 parent a4ac14f commit f00383e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Lib/test/test_string_literals.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,13 @@ def test_eval_str_u(self):
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")
Expand Down

0 comments on commit f00383e

Please sign in to comment.