mirror of
https://github.com/django/django.git
synced 2025-11-25 21:22:14 +00:00
Fixed #30027 -- Errored out on Window function usage if unsupported.
This commit is contained in:
parent
ebd2fe1861
commit
64d5bafbc6
2 changed files with 10 additions and 1 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import datetime
|
||||
from unittest import skipIf, skipUnless
|
||||
from unittest import mock, skipIf, skipUnless
|
||||
|
||||
from django.core.exceptions import FieldError
|
||||
from django.db import NotSupportedError, connection
|
||||
|
|
@ -821,6 +821,12 @@ class NonQueryWindowTests(SimpleTestCase):
|
|||
with self.assertRaisesMessage(NotSupportedError, msg):
|
||||
Employee.objects.annotate(dense_rank=Window(expression=DenseRank())).filter(dense_rank__gte=1)
|
||||
|
||||
def test_unsupported_backend(self):
|
||||
msg = 'This backend does not support window expressions.'
|
||||
with mock.patch.object(connection.features, 'supports_over_clause', False):
|
||||
with self.assertRaisesMessage(NotSupportedError, msg):
|
||||
Employee.objects.annotate(dense_rank=Window(expression=DenseRank())).get()
|
||||
|
||||
def test_invalid_order_by(self):
|
||||
msg = 'order_by must be either an Expression or a sequence of expressions'
|
||||
with self.assertRaisesMessage(ValueError, msg):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue