bpo-34013: Move the Python 2 hints from the exception constructor to the parser (GH-27392)

This commit is contained in:
Pablo Galindo Salgado 2021-07-27 21:30:32 +01:00 committed by GitHub
parent 6948964ecf
commit ecc3c8e421
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 224 deletions

View file

@ -168,21 +168,19 @@ class ExceptionTests(unittest.TestCase):
self.fail("failed to get expected SyntaxError")
s = '''print "old style"'''
ckmsg(s, "Missing parentheses in call to 'print'. "
"Did you mean print(\"old style\")?")
ckmsg(s, "Missing parentheses in call to 'print'. Did you mean print(...)?")
s = '''print "old style",'''
ckmsg(s, "Missing parentheses in call to 'print'. "
"Did you mean print(\"old style\", end=\" \")?")
ckmsg(s, "Missing parentheses in call to 'print'. Did you mean print(...)?")
s = 'print f(a+b,c)'
ckmsg(s, "Missing parentheses in call to 'print'.")
ckmsg(s, "Missing parentheses in call to 'print'. Did you mean print(...)?")
s = '''exec "old style"'''
ckmsg(s, "Missing parentheses in call to 'exec'")
ckmsg(s, "Missing parentheses in call to 'exec'. Did you mean exec(...)?")
s = 'exec f(a+b,c)'
ckmsg(s, "Missing parentheses in call to 'exec'.")
ckmsg(s, "Missing parentheses in call to 'exec'. Did you mean exec(...)?")
# should not apply to subclasses, see issue #31161
s = '''if True:\nprint "No indent"'''