diff options
author | Simon Charette <charette.s@gmail.com> | 2020-06-16 10:01:34 +0200 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-06-16 10:08:02 +0200 |
commit | ea3beb4f5a61870c87ba028369de4d2c2f316ad0 (patch) | |
tree | 6e3315aa9757a503698860d0f277254f26621c7c /tests/db_functions/text/test_right.py | |
parent | 0d6d4e78b17d7500e1a503fd2b02fdcf822d9d3c (diff) | |
download | django-ea3beb4f5a61870c87ba028369de4d2c2f316ad0.tar.gz |
Refs #30446 -- Defined default output_field of text database functions.
This prevented the default behavior of
BaseExpression._resolve_output_field from error'ing out when such
functions accepted both expressions from mixed types
(e.g. SubStr(CharField, IntegerField, IntegerField)).
Diffstat (limited to 'tests/db_functions/text/test_right.py')
-rw-r--r-- | tests/db_functions/text/test_right.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/db_functions/text/test_right.py b/tests/db_functions/text/test_right.py index 6dcbcc18f5..ab29cb9456 100644 --- a/tests/db_functions/text/test_right.py +++ b/tests/db_functions/text/test_right.py @@ -1,4 +1,4 @@ -from django.db.models import CharField, Value +from django.db.models import IntegerField, Value from django.db.models.functions import Lower, Right from django.test import TestCase @@ -23,5 +23,5 @@ class RightTests(TestCase): Author.objects.annotate(raises=Right('name', 0)) def test_expressions(self): - authors = Author.objects.annotate(name_part=Right('name', Value(3), output_field=CharField())) + authors = Author.objects.annotate(name_part=Right('name', Value(3, output_field=IntegerField()))) self.assertQuerysetEqual(authors.order_by('name'), ['ith', 'nda'], lambda a: a.name_part) |