Fixed #29619 -- Added field names to some FieldErrors.

This commit is contained in:
Hasan Ramezani 2019-02-15 00:58:08 +01:00 committed by Tim Graham
parent 5013d38380
commit 741ce81a42
4 changed files with 38 additions and 9 deletions

View file

@ -264,7 +264,8 @@ class BasicExpressionsTests(TestCase):
def test_object_create_with_aggregate(self):
# Aggregates are not allowed when inserting new data
with self.assertRaisesMessage(FieldError, 'Aggregate functions are not allowed in this query'):
msg = 'Aggregate functions are not allowed in this query (num_employees=Max(Value(1))).'
with self.assertRaisesMessage(FieldError, msg):
Company.objects.create(
name='Company', num_employees=Max(Value(1)), num_chairs=1,
ceo=Employee.objects.create(firstname="Just", lastname="Doit", salary=30),