summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2022-08-29 09:14:56 +0200
committerGitHub <noreply@github.com>2022-08-29 09:14:56 +0200
commitf210de760b06cd57ff37b416e2bf9eafb0bfe929 (patch)
treeb37864eef961a56aa37b40610aad78780435ce10 /tests
parentb92ffebb0cdc469baaf1b8f0e72dddb069eb2fb4 (diff)
Refs #28333 -- Fixed NonQueryWindowTests.test_invalid_filter() on databases that don't support window expressions.
Diffstat (limited to 'tests')
-rw-r--r--tests/expressions_window/tests.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/tests/expressions_window/tests.py b/tests/expressions_window/tests.py
index a71a3f947d..f3413102d5 100644
--- a/tests/expressions_window/tests.py
+++ b/tests/expressions_window/tests.py
@@ -1557,6 +1557,20 @@ class WindowFunctionTests(TestCase):
)
)
+ def test_invalid_filter(self):
+ msg = (
+ "Heterogeneous disjunctive predicates against window functions are not "
+ "implemented when performing conditional aggregation."
+ )
+ qs = Employee.objects.annotate(
+ window=Window(Rank()),
+ past_dept_cnt=Count("past_departments"),
+ )
+ with self.assertRaisesMessage(NotImplementedError, msg):
+ list(qs.filter(Q(window=1) | Q(department="Accounting")))
+ with self.assertRaisesMessage(NotImplementedError, msg):
+ list(qs.exclude(window=1, department="Accounting"))
+
class WindowUnsupportedTests(TestCase):
def test_unsupported_backend(self):
@@ -1613,20 +1627,6 @@ class NonQueryWindowTests(SimpleTestCase):
with self.assertRaisesMessage(NotImplementedError, msg):
frame.window_frame_start_end(None, None, None)
- def test_invalid_filter(self):
- msg = (
- "Heterogeneous disjunctive predicates against window functions are not "
- "implemented when performing conditional aggregation."
- )
- qs = Employee.objects.annotate(
- window=Window(Rank()),
- past_dept_cnt=Count("past_departments"),
- )
- with self.assertRaisesMessage(NotImplementedError, msg):
- list(qs.filter(Q(window=1) | Q(department="Accounting")))
- with self.assertRaisesMessage(NotImplementedError, msg):
- list(qs.exclude(window=1, department="Accounting"))
-
def test_invalid_order_by(self):
msg = (
"Window.order_by must be either a string reference to a field, an "