summaryrefslogtreecommitdiff
path: root/tests/postgres_tests/test_aggregates.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/postgres_tests/test_aggregates.py')
-rw-r--r--tests/postgres_tests/test_aggregates.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/postgres_tests/test_aggregates.py b/tests/postgres_tests/test_aggregates.py
index 8f3d8bb6ef..19f9596576 100644
--- a/tests/postgres_tests/test_aggregates.py
+++ b/tests/postgres_tests/test_aggregates.py
@@ -155,6 +155,12 @@ class TestGeneralAggregate(PostgreSQLTestCase):
values = AggregateTestModel.objects.aggregate(booland=BoolAnd('boolean_field'))
self.assertEqual(values, {'booland': None})
+ def test_bool_and_q_object(self):
+ values = AggregateTestModel.objects.aggregate(
+ booland=BoolAnd(Q(integer_field__gt=2)),
+ )
+ self.assertEqual(values, {'booland': False})
+
def test_bool_or_general(self):
values = AggregateTestModel.objects.aggregate(boolor=BoolOr('boolean_field'))
self.assertEqual(values, {'boolor': True})
@@ -164,6 +170,12 @@ class TestGeneralAggregate(PostgreSQLTestCase):
values = AggregateTestModel.objects.aggregate(boolor=BoolOr('boolean_field'))
self.assertEqual(values, {'boolor': None})
+ def test_bool_or_q_object(self):
+ values = AggregateTestModel.objects.aggregate(
+ boolor=BoolOr(Q(integer_field__gt=2)),
+ )
+ self.assertEqual(values, {'boolor': False})
+
def test_string_agg_requires_delimiter(self):
with self.assertRaises(TypeError):
AggregateTestModel.objects.aggregate(stringagg=StringAgg('char_field'))