mirror of https://github.com/django/django.git
Refs #28333 -- Fixed NonQueryWindowTests.test_invalid_filter() on databases that don't support window expressions.
This commit is contained in:
parent
b92ffebb0c
commit
f210de760b
|
@ -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):
|
class WindowUnsupportedTests(TestCase):
|
||||||
def test_unsupported_backend(self):
|
def test_unsupported_backend(self):
|
||||||
|
@ -1613,20 +1627,6 @@ class NonQueryWindowTests(SimpleTestCase):
|
||||||
with self.assertRaisesMessage(NotImplementedError, msg):
|
with self.assertRaisesMessage(NotImplementedError, msg):
|
||||||
frame.window_frame_start_end(None, None, None)
|
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):
|
def test_invalid_order_by(self):
|
||||||
msg = (
|
msg = (
|
||||||
"Window.order_by must be either a string reference to a field, an "
|
"Window.order_by must be either a string reference to a field, an "
|
||||||
|
|
Loading…
Reference in New Issue