diff options
| author | Claude Paroz <claude@2xlibre.net> | 2012-04-28 18:09:37 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2012-04-29 20:57:15 +0200 |
| commit | 3904b74a3f2f92fefe1d39281ed683c52f2fef03 (patch) | |
| tree | 1ae8f65371ed53df205553f41c9d0f90d1e9fee9 /tests/modeltests/basic/tests.py | |
| parent | eefb00f30124f775ca52258ccd8549054fe8230f (diff) | |
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).
Diffstat (limited to 'tests/modeltests/basic/tests.py')
| -rw-r--r-- | tests/modeltests/basic/tests.py | 10 |
1 files changed, 5 insertions, 5 deletions
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.") |
