          """
          # Check each of the allowed method names
          for method in SimpleView.http_method_names:
              kwargs = dict(((method, "value"),))
              self.assertRaises(TypeError, SimpleView.as_view, **kwargs)
  
          # Check the case view argument is ok if predefined on the class...
          CustomizableView.as_view(parameter="value")
          # ...but raises errors otherwise.
          self.assertRaises(TypeError, CustomizableView.as_view, foobar="value")
 
</s> remove         self.assertRaises(TypeError, CustomizableView.as_view, foobar="value")
 </s> add         with self.assertRaises(TypeError):
            CustomizableView.as_view(foobar="value") </s> remove             self.assertRaises(ValueError, getattr, field, 'width')
            self.assertRaises(ValueError, getattr, field, 'height')
 </s> add             with self.assertRaises(ValueError):
                getattr(field, 'width')
            with self.assertRaises(ValueError):
                getattr(field, 'height') </s> remove         self.assertRaises(ValueError, qs.aggregate, Union('name'))
 </s> add         with self.assertRaises(ValueError):
            qs.aggregate(Union('name')) </s> remove         self.assertRaises(ImproperlyConfigured, Sitemap().get_urls)
 </s> add         with self.assertRaises(ImproperlyConfigured):
            Sitemap().get_urls() </s> remove         self.assertRaises(GDALException, setattr, band, 'nodata_value', 10)
 </s> add         with self.assertRaises(GDALException):
            setattr(band, 'nodata_value', 10)
            with self.assertRaises(TypeError):
                SimpleView.as_view(**kwargs)
          """
          # Check each of the allowed method names
          for method in SimpleView.http_method_names:
              kwargs = dict(((method, "value"),))
            with self.assertRaises(TypeError):
                SimpleView.as_view(**kwargs)
  
          # Check the case view argument is ok if predefined on the class...
          CustomizableView.as_view(parameter="value")
          # ...but raises errors otherwise.
          self.assertRaises(TypeError, CustomizableView.as_view, foobar="value")
keep keep keep keep replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/generic_views/test_base.py