diff options
| author | Tilman Koschnick <til@subnetz.org> | 2021-01-28 17:50:54 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-01-29 11:05:00 +0100 |
| commit | fdfbc66331292def201c9344e3cd29fbcbcd076a (patch) | |
| tree | 42e10a5a20c101ed7cb5eeb172090147356dfb2a /tests/db_functions | |
| parent | 135c800fe6138d7818501a384c0ebbdc5442762c (diff) | |
Fixed #32392 -- Fixed ExclusionConstraint crash with Cast() in expressions.
Diffstat (limited to 'tests/db_functions')
| -rw-r--r-- | tests/db_functions/comparison/test_cast.py | 15 |
1 files changed, 1 insertions, 14 deletions
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') |
