          template = self.static_template_snippet(path, asvar)
          self.assertEqual(self.render_template(template, **kwargs), result)
  
      def assertStaticRaises(self, exc, path, result, asvar=False, **kwargs):
          self.assertRaises(exc, self.assertStaticRenders, path, result, **kwargs)
  
  
  @override_settings(**TEST_SETTINGS)
  class StaticFilesTestCase(BaseStaticFilesTestCase, SimpleTestCase):
      pass
 
</s> remove         self.assertRaises(IOError, self._get_file, filepath)
 </s> add         with self.assertRaises(IOError):
            self._get_file(filepath) </s> remove         self.assertRaises(ValueError, ModelFormMetaclass, str('Form'), (ModelForm,), {'Meta': Meta})
 </s> add         with self.assertRaises(ValueError):
            ModelFormMetaclass(str('Form'), (ModelForm,), {'Meta': Meta}) </s> remove         self.assertRaises(ImproperlyConfigured, self.client.get, '/template/no_template/')
 </s> add         with self.assertRaises(ImproperlyConfigured):
            self.client.get('/template/no_template/') </s> remove         self.assertRaises(ImproperlyConfigured, get_user, request)
 </s> add         with self.assertRaises(ImproperlyConfigured):
            get_user(request) </s> remove         self.assertRaises(InvalidCacheBackendError, self.backend)
 </s> add         with self.assertRaises(InvalidCacheBackendError):
            self.backend()
        with self.assertRaises(exc):
            self.assertStaticRenders(path, result, **kwargs)
          template = self.static_template_snippet(path, asvar)
          self.assertEqual(self.render_template(template, **kwargs), result)
  
      def assertStaticRaises(self, exc, path, result, asvar=False, **kwargs):
        with self.assertRaises(exc):
            self.assertStaticRenders(path, result, **kwargs)
  
  
  @override_settings(**TEST_SETTINGS)
  class StaticFilesTestCase(BaseStaticFilesTestCase, SimpleTestCase):
      pass
keep keep keep keep replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/staticfiles_tests/cases.py