From 3904b74a3f2f92fefe1d39281ed683c52f2fef03 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Sat, 28 Apr 2012 18:09:37 +0200 Subject: Fixed #18013 -- Use the new 'as' syntax for exceptions. Thanks Clueless for the initial patch. Note that unittest has been purposely left out (external package only used by Python 2.6). --- tests/modeltests/basic/tests.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'tests/modeltests/basic') diff --git a/tests/modeltests/basic/tests.py b/tests/modeltests/basic/tests.py index 14d35cc644..fc1f593c13 100644 --- a/tests/modeltests/basic/tests.py +++ b/tests/modeltests/basic/tests.py @@ -384,9 +384,9 @@ class ModelTest(TestCase): try: Article.objects.all()[0:1] & Article.objects.all()[4:5] self.fail('Should raise an AssertionError') - except AssertionError, e: + except AssertionError as e: self.assertEqual(str(e), "Cannot combine queries once a slice has been taken.") - except Exception, e: + except Exception as e: self.fail('Should raise an AssertionError, not %s' % e) # Negative slices are not supported, due to database constraints. @@ -394,15 +394,15 @@ class ModelTest(TestCase): try: Article.objects.all()[-1] self.fail('Should raise an AssertionError') - except AssertionError, e: + except AssertionError as e: self.assertEqual(str(e), "Negative indexing is not supported.") - except Exception, e: + except Exception as e: self.fail('Should raise an AssertionError, not %s' % e) error = None try: Article.objects.all()[0:-5] - except Exception, e: + except Exception as e: error = e self.assertTrue(isinstance(error, AssertionError)) self.assertEqual(str(error), "Negative indexing is not supported.") -- cgit v1.3