diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/postgres_tests/migrations/0002_create_test_models.py | 6 | ||||
| -rw-r--r-- | tests/servers/tests.py | 14 |
2 files changed, 9 insertions, 11 deletions
diff --git a/tests/postgres_tests/migrations/0002_create_test_models.py b/tests/postgres_tests/migrations/0002_create_test_models.py index 3e6cbac246..69c5b17f77 100644 --- a/tests/postgres_tests/migrations/0002_create_test_models.py +++ b/tests/postgres_tests/migrations/0002_create_test_models.py @@ -3,7 +3,11 @@ from __future__ import unicode_literals from django.db import migrations, models -from ..fields import * # NOQA +from ..fields import ( + ArrayField, BigIntegerRangeField, DateRangeField, DateTimeRangeField, + FloatRangeField, HStoreField, IntegerRangeField, JSONField, + SearchVectorField, +) from ..models import TagField diff --git a/tests/servers/tests.py b/tests/servers/tests.py index 39faba2023..57573622b0 100644 --- a/tests/servers/tests.py +++ b/tests/servers/tests.py @@ -104,12 +104,9 @@ class LiveServerViews(LiveServerBase): Ensure that the LiveServerTestCase serves 404s. Refs #2879. """ - try: + with self.assertRaises(HTTPError) as err: self.urlopen('/') - except HTTPError as err: - self.assertEqual(err.code, 404, 'Expected 404 response') - else: - self.fail('Expected 404 response') + self.assertEqual(err.exception.code, 404, 'Expected 404 response') def test_view(self): """ @@ -133,12 +130,9 @@ class LiveServerViews(LiveServerBase): tries to access a static file that isn't explicitly put under STATIC_ROOT. """ - try: + with self.assertRaises(HTTPError) as err: self.urlopen('/static/another_app/another_app_static_file.txt') - except HTTPError as err: - self.assertEqual(err.code, 404, 'Expected 404 response') - else: - self.fail('Expected 404 response (got %d)' % err.code) + self.assertEqual(err.exception.code, 404, 'Expected 404 response') def test_media_files(self): """ |
