diff options
| author | Hasan <hasan.r67@gmail.com> | 2016-01-17 14:56:39 +0330 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-01-29 12:32:18 -0500 |
| commit | 3d0dcd7f5af378d3ab6adb303b913e6c7b2e0ee5 (patch) | |
| tree | 0d1074cc65a72096e44a4165611fddfc5b7ef7fb /tests/contenttypes_tests | |
| parent | 575706331bec4bf58ce36a9540c4c61fca49025b (diff) | |
Refs #26022 -- Used context manager version of assertRaises in tests.
Diffstat (limited to 'tests/contenttypes_tests')
| -rw-r--r-- | tests/contenttypes_tests/test_models.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/contenttypes_tests/test_models.py b/tests/contenttypes_tests/test_models.py index 37e0b93048..12010ac781 100644 --- a/tests/contenttypes_tests/test_models.py +++ b/tests/contenttypes_tests/test_models.py @@ -208,7 +208,8 @@ class ContentTypesTests(TestCase): user_ct = ContentType.objects.get_for_model(FooWithoutUrl) obj = FooWithoutUrl.objects.create(name="john") - self.assertRaises(Http404, shortcut, request, user_ct.id, obj.id) + with self.assertRaises(Http404): + shortcut(request, user_ct.id, obj.id) def test_shortcut_view_with_broken_get_absolute_url(self): """ @@ -224,7 +225,8 @@ class ContentTypesTests(TestCase): user_ct = ContentType.objects.get_for_model(FooWithBrokenAbsoluteUrl) obj = FooWithBrokenAbsoluteUrl.objects.create(name="john") - self.assertRaises(AttributeError, shortcut, request, user_ct.id, obj.id) + with self.assertRaises(AttributeError): + shortcut(request, user_ct.id, obj.id) def test_missing_model(self): """ |
