summaryrefslogtreecommitdiff
path: root/tests/update
diff options
context:
space:
mode:
authorHasan Ramezani <hasan.r67@gmail.com>2019-02-15 00:58:08 +0100
committerTim Graham <timograham@gmail.com>2019-02-14 18:58:08 -0500
commit741ce81a426e4d0cd7581d98d3b8e3290f513f09 (patch)
treec28bccf8174d704132df8ebf68114884a79cc2ba /tests/update
parent5013d38380f19cdbc651ec2978b9b77955fddae5 (diff)
downloaddjango-741ce81a426e4d0cd7581d98d3b8e3290f513f09.tar.gz
Fixed #29619 -- Added field names to some FieldErrors.
Diffstat (limited to 'tests/update')
-rw-r--r--tests/update/tests.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/update/tests.py b/tests/update/tests.py
index 63e930bfa0..8cb4d11f75 100644
--- a/tests/update/tests.py
+++ b/tests/update/tests.py
@@ -165,7 +165,11 @@ class AdvancedTests(TestCase):
self.assertEqual(qs.update(another_value=F('alias')), 3)
# Update where aggregation annotation is used in update parameters
qs = DataPoint.objects.annotate(max=Max('value'))
- with self.assertRaisesMessage(FieldError, 'Aggregate functions are not allowed in this query'):
+ msg = (
+ 'Aggregate functions are not allowed in this query '
+ '(another_value=Max(Col(update_datapoint, update.DataPoint.value))).'
+ )
+ with self.assertRaisesMessage(FieldError, msg):
qs.update(another_value=F('max'))
def test_update_annotated_multi_table_queryset(self):
@@ -185,5 +189,9 @@ class AdvancedTests(TestCase):
# self.assertEqual(updated, 1)
# Update where aggregation annotation is used in update parameters
qs = RelatedPoint.objects.annotate(max=Max('data__value'))
- with self.assertRaisesMessage(FieldError, 'Aggregate functions are not allowed in this query'):
+ msg = (
+ 'Aggregate functions are not allowed in this query '
+ '(name=Max(Col(update_datapoint, update.DataPoint.value))).'
+ )
+ with self.assertRaisesMessage(FieldError, msg):
qs.update(name=F('max'))