          )
  
          # Regression for #10766 - Shouldn't be able to reference an aggregate
          # fields in an aggregate() call.
          with self.assertRaises(FieldError):
              Book.objects.annotate(mean_age=Avg('authors__age')).annotate(Avg('mean_age'))
  
      def test_empty_filter_count(self):
          self.assertEqual(
              Author.objects.filter(id__in=[]).annotate(Count("friends")).count(),
 
</s> remove         with self.assertRaises(ValueError):
 </s> add         msg = "The annotation 'age' conflicts with a field on the model."
        with self.assertRaisesMessage(ValueError, msg): </s> remove         with self.assertRaises(ValueError):
 </s> add         msg = (
            "The named annotation 'authors__age__avg' conflicts with "
            "the default name for another annotation."
        )
        with self.assertRaisesMessage(ValueError, msg): </s> remove         with self.assertRaises(ValueError):
 </s> add         msg = "The annotation 'friends' conflicts with a field on the model."
        with self.assertRaisesMessage(ValueError, msg): </s> remove         with self.assertRaises(ValueError):
 </s> add         msg = "The annotation 'book_contact_set' conflicts with a field on the model."
        with self.assertRaisesMessage(ValueError, msg): </s> remove         with self.assertRaises(FieldError):
 </s> add         msg = (
            "Cannot resolve keyword 'foo' into field. Choices are: authors, "
            "contact, contact_id, hardbackbook, id, isbn, name, num_authors, "
            "pages, price, pubdate, publisher, publisher_id, rating, store, tags"
        )
        with self.assertRaisesMessage(FieldError, msg):
        msg = "Cannot compute Avg('mean_age'): 'mean_age' is an aggregate"
        with self.assertRaisesMessage(FieldError, msg):
          )
  
          # Regression for #10766 - Shouldn't be able to reference an aggregate
          # fields in an aggregate() call.
        msg = "Cannot compute Avg('mean_age'): 'mean_age' is an aggregate"
        with self.assertRaisesMessage(FieldError, msg):
              Book.objects.annotate(mean_age=Avg('authors__age')).annotate(Avg('mean_age'))
  
      def test_empty_filter_count(self):
          self.assertEqual(
              Author.objects.filter(id__in=[]).annotate(Count("friends")).count(),
keep keep keep keep replace keep keep keep keep keep
 Used assertRaisesMessage() to test Django's error messages. 
tests/aggregation_regress/tests.py