diff options
author | Hasan Ramezani <hasan.r67@gmail.com> | 2019-02-15 00:58:08 +0100 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2019-02-14 18:58:08 -0500 |
commit | 741ce81a426e4d0cd7581d98d3b8e3290f513f09 (patch) | |
tree | c28bccf8174d704132df8ebf68114884a79cc2ba /tests/expressions_window | |
parent | 5013d38380f19cdbc651ec2978b9b77955fddae5 (diff) | |
download | django-741ce81a426e4d0cd7581d98d3b8e3290f513f09.tar.gz |
Fixed #29619 -- Added field names to some FieldErrors.
Diffstat (limited to 'tests/expressions_window')
-rw-r--r-- | tests/expressions_window/tests.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/expressions_window/tests.py b/tests/expressions_window/tests.py index d9a4a4fa6c..129912b93a 100644 --- a/tests/expressions_window/tests.py +++ b/tests/expressions_window/tests.py @@ -670,7 +670,12 @@ class WindowFunctionTests(TestCase): def test_fail_update(self): """Window expressions can't be used in an UPDATE statement.""" - msg = 'Window expressions are not allowed in this query' + msg = ( + 'Window expressions are not allowed in this query (salary=<Window: ' + 'Max(Col(expressions_window_employee, expressions_window.Employee.salary)) ' + 'OVER (PARTITION BY Col(expressions_window_employee, ' + 'expressions_window.Employee.department))>).' + ) with self.assertRaisesMessage(FieldError, msg): Employee.objects.filter(department='Management').update( salary=Window(expression=Max('salary'), partition_by='department'), @@ -678,7 +683,10 @@ class WindowFunctionTests(TestCase): def test_fail_insert(self): """Window expressions can't be used in an INSERT statement.""" - msg = 'Window expressions are not allowed in this query' + msg = ( + 'Window expressions are not allowed in this query (salary=<Window: ' + 'Sum(Value(10000), order_by=OrderBy(F(pk), descending=False)) OVER ()' + ) with self.assertRaisesMessage(FieldError, msg): Employee.objects.create( name='Jameson', department='Management', hire_date=datetime.date(2007, 7, 1), |