mirror of
https://github.com/python/cpython
synced 2024-09-06 05:03:22 +00:00
gh-94808: Coverage: Test uppercase string literal prefixes (GH-95925)
This commit is contained in:
parent
a4ac14faa5
commit
f00383ec9b
|
@ -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")
|
||||
|
|
Loading…
Reference in a new issue