          except AttributeError:
              self.fail("Shouldn't get an AttributeError due to undefined 404 handler")
  
          try:
              self.assertRaises(ValueError, self.client.get, '/bad_view/')
          except AttributeError:
              self.fail("Shouldn't get an AttributeError due to undefined 500 handler")
  
  
  @override_settings(ROOT_URLCONF=None)
 
</s> remove         self.assertRaises(KeyError, self.client.get, "/broken_view/")
 </s> add         with self.assertRaises(KeyError):
            self.client.get("/broken_view/") </s> remove         self.assertRaises(ImproperlyConfigured, Sitemap().get_urls)
 </s> add         with self.assertRaises(ImproperlyConfigured):
            Sitemap().get_urls() </s> remove         self.assertRaises(
            Book.DoesNotExist,
            Book.objects.using('other').get,
            title="Pro Django"
        )
 </s> add         with self.assertRaises(Book.DoesNotExist):
            Book.objects.using('other').get(title="Pro Django") </s> remove         self.assertRaises(
            Book.DoesNotExist,
            Book.objects.get,
            title="Dive into Python"
        )
        self.assertRaises(
            Book.DoesNotExist,
            Book.objects.using('default').get,
            title="Dive into Python"
        )
 </s> add         with self.assertRaises(Book.DoesNotExist):
            Book.objects.get(title="Dive into Python")
        with self.assertRaises(Book.DoesNotExist):
            Book.objects.using('default').get(title="Dive into Python") </s> remove         self.assertRaises(forms.ValidationError, f.clean, '13:30:05 21.12.2010')
 </s> add         with self.assertRaises(forms.ValidationError):
            f.clean('13:30:05 21.12.2010')
            with self.assertRaises(ValueError):
                self.client.get('/bad_view/')
          except AttributeError:
              self.fail("Shouldn't get an AttributeError due to undefined 404 handler")
  
          try:
            with self.assertRaises(ValueError):
                self.client.get('/bad_view/')
          except AttributeError:
              self.fail("Shouldn't get an AttributeError due to undefined 500 handler")
  
  
  @override_settings(ROOT_URLCONF=None)
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