      def test_invalid_qs_list(self):
          # Test for #19895 - second iteration over invalid queryset
          # raises errors.
          qs = Article.objects.order_by('invalid_column')
          self.assertRaises(FieldError, list, qs)
          self.assertRaises(FieldError, list, qs)
  
  
  class NullJoinPromotionOrTest(TestCase):
      @classmethod
      def setUpTestData(cls):
 
</s> remove         self.assertRaises(ValueError, Author.objects.annotate, book_contact_set=Avg('friends__age'))
 </s> add         with self.assertRaises(ValueError):
            Author.objects.annotate(book_contact_set=Avg('friends__age')) </s> remove         self.assertRaises(FieldError, modelform_factory,
                          Person, fields=['no-field', 'name'])
 </s> add         with self.assertRaises(FieldError):
            modelform_factory(Person, fields=['no-field', 'name']) </s> remove         self.assertRaises(ContentNotRenderedError, iteration)
 </s> add         with self.assertRaises(ContentNotRenderedError):
            iteration() </s> remove         self.assertRaises(ValueError, Author.objects.annotate, age=Avg('friends__age'))
 </s> add         with self.assertRaises(ValueError):
            Author.objects.annotate(age=Avg('friends__age')) </s> remove         self.assertRaises(FieldError, test_gmbh.save)
 </s> add         with self.assertRaises(FieldError):
            test_gmbh.save()
        with self.assertRaises(FieldError):
            list(qs)
        with self.assertRaises(FieldError):
            list(qs)
      def test_invalid_qs_list(self):
          # Test for #19895 - second iteration over invalid queryset
          # raises errors.
          qs = Article.objects.order_by('invalid_column')
        with self.assertRaises(FieldError):
            list(qs)
        with self.assertRaises(FieldError):
            list(qs)
        with self.assertRaises(FieldError):
            list(qs)
        with self.assertRaises(FieldError):
            list(qs)
  
  
  class NullJoinPromotionOrTest(TestCase):
      @classmethod
      def setUpTestData(cls):
keep keep keep keep replace replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/queries/tests.py