Skip to content

Commit

Permalink
Fixed NonQueryWindowTests.test_unsupported_backend() on MySQL.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixxm committed May 3, 2019
1 parent e683613 commit 8c5649b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tests/expressions_window/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,14 @@ def test_invalid_type_start_row_range(self):
)))


class WindowUnsupportedTests(TestCase):
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()


class NonQueryWindowTests(SimpleTestCase):
def test_window_repr(self):
self.assertEqual(
Expand Down Expand Up @@ -828,12 +836,6 @@ def test_invalid_filter(self):
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):
Expand Down

0 comments on commit 8c5649b

Please sign in to comment.