SF patch# 1755885 by Kurt Kaiser: show location of Unicode escape errors.

(Slightly tweaked for style and refcounts.)
This commit is contained in:
Guido van Rossum 2007-07-18 17:19:14 +00:00
parent a3a4c2f411
commit b6ac23cd07
2 changed files with 25 additions and 2 deletions

View file

@ -474,6 +474,12 @@ class CompileTestCase(unittest.TestCase):
st = parser.suite('1 = 3 + 4')
self.assertRaises(SyntaxError, parser.compilest, st)
def test_compile_badunicode(self):
st = parser.suite('a = u"\U12345678"')
self.assertRaises(SyntaxError, parser.compilest, st)
st = parser.suite('a = u"\u1"')
self.assertRaises(SyntaxError, parser.compilest, st)
def test_main():
test_support.run_unittest(
RoundtripLegalSyntaxTestCase,