  
      def test_field_name_conflict(self):
          # Regression for #11256 - providing an aggregate name
          # that conflicts with a field name on the model raises ValueError
          with self.assertRaises(ValueError):
              Author.objects.annotate(age=Avg('friends__age'))
  
      def test_m2m_name_conflict(self):
          # Regression for #11256 - providing an aggregate name
          # that conflicts with an m2m name on the model raises ValueError
 
</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 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 '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 compute Avg('mean_age'): 'mean_age' is an aggregate"
        with self.assertRaisesMessage(FieldError, msg): </s> remove         with self.assertRaises(ImproperlyConfigured):
 </s> add         msg = "'apps.apps.BadConfig' must supply a name attribute."
        with self.assertRaisesMessage(ImproperlyConfigured, msg):
        msg = "The annotation 'age' conflicts with a field on the model."
        with self.assertRaisesMessage(ValueError, msg):
  
      def test_field_name_conflict(self):
          # Regression for #11256 - providing an aggregate name
          # that conflicts with a field name on the model raises ValueError
        msg = "The annotation 'age' conflicts with a field on the model."
        with self.assertRaisesMessage(ValueError, msg):
              Author.objects.annotate(age=Avg('friends__age'))
  
      def test_m2m_name_conflict(self):
          # Regression for #11256 - providing an aggregate name
          # that conflicts with an m2m name on the model raises ValueError
keep keep keep keep replace keep keep keep keep keep
 Used assertRaisesMessage() to test Django's error messages. 
tests/aggregation_regress/tests.py