      def test_redirect_view_object(self):
          from .views import absolute_kwargs_view
          res = redirect(absolute_kwargs_view)
          self.assertEqual(res.url, '/absolute_arg_view/')
          self.assertRaises(NoReverseMatch, redirect, absolute_kwargs_view, wrong_argument=None)
  
  
  @override_settings(ROOT_URLCONF='urlpatterns_reverse.namespace_urls')
  @ignore_warnings(category=RemovedInDjango20Warning)
  class NamespaceTests(SimpleTestCase):
 
</s> remove         self.assertRaises(NoReverseMatch, redirect, 'not-a-view')
 </s> add         with self.assertRaises(NoReverseMatch):
            redirect('not-a-view') </s> remove         self.assertRaises(NoReverseMatch, reverse, 'urlobject-view')
        self.assertRaises(NoReverseMatch, reverse, 'urlobject-view', args=[37, 42])
        self.assertRaises(NoReverseMatch, reverse, 'urlobject-view', kwargs={'arg1': 42, 'arg2': 37})
 </s> add         with self.assertRaises(NoReverseMatch):
            reverse('urlobject-view')
        with self.assertRaises(NoReverseMatch):
            reverse('urlobject-view', args=[37, 42])
        with self.assertRaises(NoReverseMatch):
            reverse('urlobject-view', kwargs={'arg1': 42, 'arg2': 37}) </s> remove         self.assertRaises(ImproperlyConfigured, self.client.get, '/test/me/')
 </s> add         with self.assertRaises(ImproperlyConfigured):
            self.client.get('/test/me/') </s> remove         self.assertRaises(ObjectDoesNotExist, self.client.get, '/detail/doesnotexist/1/')
 </s> add         with self.assertRaises(ObjectDoesNotExist):
            self.client.get('/detail/doesnotexist/1/') </s> remove         self.assertRaises(ImproperlyConfigured, self.client.get, '/detail/author/invalid/qs/')
 </s> add         with self.assertRaises(ImproperlyConfigured):
            self.client.get('/detail/author/invalid/qs/')
        with self.assertRaises(NoReverseMatch):
            redirect(absolute_kwargs_view, wrong_argument=None)
      def test_redirect_view_object(self):
          from .views import absolute_kwargs_view
          res = redirect(absolute_kwargs_view)
          self.assertEqual(res.url, '/absolute_arg_view/')
        with self.assertRaises(NoReverseMatch):
            redirect(absolute_kwargs_view, wrong_argument=None)
  
  
  @override_settings(ROOT_URLCONF='urlpatterns_reverse.namespace_urls')
  @ignore_warnings(category=RemovedInDjango20Warning)
  class NamespaceTests(SimpleTestCase):
keep keep keep keep replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/urlpatterns_reverse/tests.py