summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Smeaton <josh.smeaton@gmail.com>2015-02-13 10:06:46 +1100
committerJosh Smeaton <josh.smeaton@gmail.com>2015-02-13 11:24:25 +1100
commit47b23ca2ee4d26a50895adf0fba19020b27d8d84 (patch)
tree7476a21f735748e59a233d37247d9adc2fcd02dd
parent1784c326b1040bc1957a6f9664fdd2a8647bde50 (diff)
[1.8.x] Refs #14030 -- Added tests for Value aggregates
Backport of bd4afef98490198e325654952d38a5735ee7e358 from master
-rw-r--r--tests/aggregation/tests.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py
index bc3929d98e..bf4097205e 100644
--- a/tests/aggregation/tests.py
+++ b/tests/aggregation/tests.py
@@ -8,7 +8,7 @@ from django.core.exceptions import FieldError
from django.db import connection
from django.db.models import (
F, Aggregate, Avg, Count, DecimalField, FloatField, Func, IntegerField,
- Max, Min, Sum,
+ Max, Min, Sum, Value,
)
from django.test import TestCase, ignore_warnings
from django.test.utils import Approximate, CaptureQueriesContext
@@ -706,7 +706,9 @@ class ComplexAggregateTestCase(TestCase):
Book.objects.aggregate(fail=F('price'))
def test_nonfield_annotation(self):
- book = Book.objects.annotate(val=Max(2, output_field=IntegerField()))[0]
+ book = Book.objects.annotate(val=Max(Value(2, output_field=IntegerField())))[0]
+ self.assertEqual(book.val, 2)
+ book = Book.objects.annotate(val=Max(Value(2), output_field=IntegerField()))[0]
self.assertEqual(book.val, 2)
book = Book.objects.annotate(val=Max(2, output_field=IntegerField()))[0]
self.assertEqual(book.val, 2)