      def test_content_access_unrendered(self):
          # unrendered response raises an exception when content is accessed
          response = self._response()
          self.assertFalse(response.is_rendered)
          self.assertRaises(ContentNotRenderedError, lambda: response.content)
          self.assertFalse(response.is_rendered)
  
      def test_content_access_rendered(self):
          # rendered response content can be accessed
          response = self._response().render()
 
</s> remove         self.assertRaises(ContentNotRenderedError, iteration)
 </s> add         with self.assertRaises(ContentNotRenderedError):
            iteration() </s> remove         self.assertRaises(signing.BadSignature,
            request.get_signed_cookie, 'c')
 </s> add         with self.assertRaises(signing.BadSignature):
            request.get_signed_cookie('c') </s> remove         self.assertRaises(StopIteration, next, generator)
 </s> add         with self.assertRaises(StopIteration):
            next(generator) </s> remove         self.assertRaises(ContentNotRenderedError,
                          pickle.dumps, response)
 </s> add         with self.assertRaises(ContentNotRenderedError):
            pickle.dumps(response) </s> remove         self.assertRaises(ContentNotRenderedError,
                          pickle.dumps, response)
 </s> add         with self.assertRaises(ContentNotRenderedError):
            pickle.dumps(response)
        with self.assertRaises(ContentNotRenderedError):
            response.content
      def test_content_access_unrendered(self):
          # unrendered response raises an exception when content is accessed
          response = self._response()
          self.assertFalse(response.is_rendered)
        with self.assertRaises(ContentNotRenderedError):
            response.content
          self.assertFalse(response.is_rendered)
  
      def test_content_access_rendered(self):
          # rendered response content can be accessed
          response = self._response().render()
keep keep keep keep replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/template_tests/test_response.py