From fdfbc66331292def201c9344e3cd29fbcbcd076a Mon Sep 17 00:00:00 2001 From: Tilman Koschnick Date: Thu, 28 Jan 2021 17:50:54 +0100 Subject: Fixed #32392 -- Fixed ExclusionConstraint crash with Cast() in expressions. --- tests/db_functions/comparison/test_cast.py | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'tests/db_functions') diff --git a/tests/db_functions/comparison/test_cast.py b/tests/db_functions/comparison/test_cast.py index 18344fe656..687cf77656 100644 --- a/tests/db_functions/comparison/test_cast.py +++ b/tests/db_functions/comparison/test_cast.py @@ -1,12 +1,9 @@ import datetime import decimal -import unittest from django.db import connection, models from django.db.models.functions import Cast -from django.test import ( - TestCase, ignore_warnings, override_settings, skipUnlessDBFeature, -) +from django.test import TestCase, ignore_warnings, skipUnlessDBFeature from ..models import Author, DTModel, Fan, FloatModel @@ -128,15 +125,5 @@ class CastTests(TestCase): self.assertIsInstance(cast_float, float) self.assertEqual(cast_float, 0.125) - @unittest.skipUnless(connection.vendor == 'postgresql', 'PostgreSQL test') - @override_settings(DEBUG=True) - def test_expression_wrapped_with_parentheses_on_postgresql(self): - """ - The SQL for the Cast expression is wrapped with parentheses in case - it's a complex expression. - """ - list(Author.objects.annotate(cast_float=Cast(models.Avg('age'), models.FloatField()))) - self.assertIn('(AVG("db_functions_author"."age"))::double precision', connection.queries[-1]['sql']) - def test_cast_to_text_field(self): self.assertEqual(Author.objects.values_list(Cast('age', models.TextField()), flat=True).get(), '1') -- cgit v1.3