From 34d6bceec46c5d4234c156ed682573d2e5de474a Mon Sep 17 00:00:00 2001 From: Srinivas Reddy Thatiparthy Date: Sun, 1 Jul 2018 02:19:20 +0530 Subject: Fixed #29500 -- Fixed SQLite function crashes on null values. Co-authored-by: Srinivas Reddy Thatiparthy Co-authored-by: Nick Pope --- tests/db_functions/math/test_sqrt.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests/db_functions/math/test_sqrt.py') diff --git a/tests/db_functions/math/test_sqrt.py b/tests/db_functions/math/test_sqrt.py index 81f13361e1..0e6238a141 100644 --- a/tests/db_functions/math/test_sqrt.py +++ b/tests/db_functions/math/test_sqrt.py @@ -11,6 +11,11 @@ from ..models import DecimalModel, FloatModel, IntegerModel class SqrtTests(TestCase): + def test_null(self): + IntegerModel.objects.create() + obj = IntegerModel.objects.annotate(null_sqrt=Sqrt('normal')).first() + self.assertIsNone(obj.null_sqrt) + def test_decimal(self): DecimalModel.objects.create(n1=Decimal('12.9'), n2=Decimal('0.6')) obj = DecimalModel.objects.annotate(n1_sqrt=Sqrt('n1'), n2_sqrt=Sqrt('n2')).first() -- cgit v1.3