          """
          field = getattr(instance, field_name)
          # Check height/width attributes of field.
          if width is None and height is None:
              self.assertRaises(ValueError, getattr, field, 'width')
              self.assertRaises(ValueError, getattr, field, 'height')
          else:
              self.assertEqual(field.width, width)
              self.assertEqual(field.height, height)
  
          # Check height/width fields of model, if defined.
 
</s> remove             self.assertRaises(TypeError, SimpleView.as_view, **kwargs)
 </s> add             with self.assertRaises(TypeError):
                SimpleView.as_view(**kwargs) </s> remove         self.assertRaises(ValueError, setattr, p, 'restaurant', None)
 </s> add         with self.assertRaises(ValueError):
            setattr(p, 'restaurant', None) </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, setattr, p, 'restaurant', p)
 </s> add         with self.assertRaises(ValueError):
            setattr(p, 'restaurant', p) </s> remove         self.assertRaises(ImproperlyConfigured, Sitemap().get_urls)
 </s> add         with self.assertRaises(ImproperlyConfigured):
            Sitemap().get_urls()
            with self.assertRaises(ValueError):
                getattr(field, 'width')
            with self.assertRaises(ValueError):
                getattr(field, 'height')
          """
          field = getattr(instance, field_name)
          # Check height/width attributes of field.
          if width is None and height is None:
            with self.assertRaises(ValueError):
                getattr(field, 'width')
            with self.assertRaises(ValueError):
                getattr(field, 'height')
            with self.assertRaises(ValueError):
                getattr(field, 'width')
            with self.assertRaises(ValueError):
                getattr(field, 'height')
          else:
              self.assertEqual(field.width, width)
              self.assertEqual(field.height, height)
  
          # Check height/width fields of model, if defined.
keep keep keep keep replace replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/model_fields/test_imagefield.py