mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
SF patch 1631942 by Collin Winter:
(a) "except E, V" -> "except E as V" (b) V is now limited to a simple name (local variable) (c) V is now deleted at the end of the except block
This commit is contained in:
parent
893523e80a
commit
b940e113bf
295 changed files with 817 additions and 743 deletions
|
@ -29,7 +29,7 @@ class FutureTest(unittest.TestCase):
|
|||
def test_badfuture3(self):
|
||||
try:
|
||||
from test import badsyntax_future3
|
||||
except SyntaxError, msg:
|
||||
except SyntaxError as msg:
|
||||
self.assertEqual(get_error_location(msg), ("badsyntax_future3", '3'))
|
||||
else:
|
||||
self.fail("expected exception didn't occur")
|
||||
|
@ -37,7 +37,7 @@ class FutureTest(unittest.TestCase):
|
|||
def test_badfuture4(self):
|
||||
try:
|
||||
from test import badsyntax_future4
|
||||
except SyntaxError, msg:
|
||||
except SyntaxError as msg:
|
||||
self.assertEqual(get_error_location(msg), ("badsyntax_future4", '3'))
|
||||
else:
|
||||
self.fail("expected exception didn't occur")
|
||||
|
@ -45,7 +45,7 @@ class FutureTest(unittest.TestCase):
|
|||
def test_badfuture5(self):
|
||||
try:
|
||||
from test import badsyntax_future5
|
||||
except SyntaxError, msg:
|
||||
except SyntaxError as msg:
|
||||
self.assertEqual(get_error_location(msg), ("badsyntax_future5", '4'))
|
||||
else:
|
||||
self.fail("expected exception didn't occur")
|
||||
|
@ -53,7 +53,7 @@ class FutureTest(unittest.TestCase):
|
|||
def test_badfuture6(self):
|
||||
try:
|
||||
from test import badsyntax_future6
|
||||
except SyntaxError, msg:
|
||||
except SyntaxError as msg:
|
||||
self.assertEqual(get_error_location(msg), ("badsyntax_future6", '3'))
|
||||
else:
|
||||
self.fail("expected exception didn't occur")
|
||||
|
@ -61,7 +61,7 @@ class FutureTest(unittest.TestCase):
|
|||
def test_badfuture7(self):
|
||||
try:
|
||||
from test import badsyntax_future7
|
||||
except SyntaxError, msg:
|
||||
except SyntaxError as msg:
|
||||
self.assertEqual(get_error_location(msg), ("badsyntax_future7", '3'))
|
||||
else:
|
||||
self.fail("expected exception didn't occur")
|
||||
|
@ -69,7 +69,7 @@ class FutureTest(unittest.TestCase):
|
|||
def test_badfuture8(self):
|
||||
try:
|
||||
from test import badsyntax_future8
|
||||
except SyntaxError, msg:
|
||||
except SyntaxError as msg:
|
||||
self.assertEqual(get_error_location(msg), ("badsyntax_future8", '3'))
|
||||
else:
|
||||
self.fail("expected exception didn't occur")
|
||||
|
@ -77,7 +77,7 @@ class FutureTest(unittest.TestCase):
|
|||
def test_badfuture9(self):
|
||||
try:
|
||||
from test import badsyntax_future9
|
||||
except SyntaxError, msg:
|
||||
except SyntaxError as msg:
|
||||
self.assertEqual(get_error_location(msg), ("badsyntax_future9", '3'))
|
||||
else:
|
||||
self.fail("expected exception didn't occur")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue