  
      def test_undefined_order(self):
          # Using an unordered queryset with more than one ordered value
          # is an error.
          with self.assertRaises(ValueError):
              self.assertQuerysetEqual(
                  Person.objects.all(),
                  [repr(self.p1), repr(self.p2)]
              )
          # No error for one value.
 
</s> remove         with self.assertRaises(ValueError):
 </s> add         msg = 'The database backend does not accept 0 as a value for AutoField.'
        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(TypeError):
 </s> add         msg = 'Model instances without primary key value are unhashable'
        with self.assertRaisesMessage(TypeError, msg): </s> remove         with self.assertRaises(ValueError):
 </s> add         msg = "The annotation 'age' conflicts with a field on the model."
        with self.assertRaisesMessage(ValueError, msg):
        msg = 'Trying to compare non-ordered queryset against more than one ordered values'
        with self.assertRaisesMessage(ValueError, msg):
  
      def test_undefined_order(self):
          # Using an unordered queryset with more than one ordered value
          # is an error.
        msg = 'Trying to compare non-ordered queryset against more than one ordered values'
        with self.assertRaisesMessage(ValueError, msg):
              self.assertQuerysetEqual(
                  Person.objects.all(),
                  [repr(self.p1), repr(self.p2)]
              )
          # No error for one value.
keep keep keep keep replace keep keep keep keep keep
 Used assertRaisesMessage() to test Django's error messages. 
tests/test_utils/tests.py