1
0
mirror of https://github.com/django/django.git synced 2025-10-27 15:46:10 +00:00

[3.1.x] Fixed #31651 -- Made ExpressionWrapper use grouping columns from wrapped expression.

Backport of df32fd42b8 from master
This commit is contained in:
Thodoris Sotiropoulos
2020-06-03 00:14:01 +03:00
committed by Mariusz Felisiak
parent 52784a83ce
commit fdd2b01e8e
2 changed files with 13 additions and 0 deletions

View File

@@ -1828,3 +1828,13 @@ class CombinableTests(SimpleTestCase):
def test_reversed_or(self):
with self.assertRaisesMessage(NotImplementedError, self.bitwise_msg):
object() | Combinable()
class ExpressionWrapperTests(SimpleTestCase):
def test_empty_group_by(self):
expr = ExpressionWrapper(Value(3), output_field=IntegerField())
self.assertEqual(expr.get_group_by_cols(alias=None), [])
def test_non_empty_group_by(self):
expr = ExpressionWrapper(Lower(Value('f')), output_field=IntegerField())
self.assertEqual(expr.get_group_by_cols(alias=None), [expr.expression])