summaryrefslogtreecommitdiff
path: root/tests/annotations
diff options
context:
space:
mode:
authorSergey Fedoseev <fedoseev.sergey@gmail.com>2017-08-11 02:42:30 +0500
committerTim Graham <timograham@gmail.com>2017-08-10 17:42:30 -0400
commitc3c6c92d769d44a98299c462c48a9599c0172e91 (patch)
tree5ef50917f662cb2cbf1dc6187264b5f29f61fae7 /tests/annotations
parent660d50805b6788d592b4f1fae706b725baf0195c (diff)
downloaddjango-c3c6c92d769d44a98299c462c48a9599c0172e91.tar.gz
Refs #18247 -- Fixed filtering on CombinedExpression(output_field=DecimalField()) annotation on SQLite.
Diffstat (limited to 'tests/annotations')
-rw-r--r--tests/annotations/tests.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/annotations/tests.py b/tests/annotations/tests.py
index 1714076e1d..aaf56e79ef 100644
--- a/tests/annotations/tests.py
+++ b/tests/annotations/tests.py
@@ -244,6 +244,10 @@ class NonAggregateAnnotationTestCase(TestCase):
sum_rating=Sum('rating')
).filter(sum_rating=F('nope')))
+ def test_filter_decimal_annotation(self):
+ qs = Book.objects.annotate(new_price=F('price') + 1).filter(new_price=Decimal(31)).values_list('new_price')
+ self.assertEqual(qs.get(), (Decimal(31),))
+
def test_combined_annotation_commutative(self):
book1 = Book.objects.annotate(adjusted_rating=F('rating') + 2).get(pk=self.b1.pk)
book2 = Book.objects.annotate(adjusted_rating=2 + F('rating')).get(pk=self.b1.pk)