mirror of
https://github.com/django/django.git
synced 2025-11-25 21:22:14 +00:00
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)).
This commit is contained in:
parent
0d6d4e78b1
commit
ea3beb4f5a
6 changed files with 16 additions and 12 deletions
|
|
@ -1,5 +1,5 @@
|
|||
from django.db import connection
|
||||
from django.db.models import CharField, Value
|
||||
from django.db.models import Value
|
||||
from django.db.models.functions import Length, Repeat
|
||||
from django.test import TestCase
|
||||
|
||||
|
|
@ -13,8 +13,8 @@ class RepeatTests(TestCase):
|
|||
tests = (
|
||||
(Repeat('name', 0), ''),
|
||||
(Repeat('name', 2), 'JohnJohn'),
|
||||
(Repeat('name', Length('alias'), output_field=CharField()), 'JohnJohnJohn'),
|
||||
(Repeat(Value('x'), 3, output_field=CharField()), 'xxx'),
|
||||
(Repeat('name', Length('alias')), 'JohnJohnJohn'),
|
||||
(Repeat(Value('x'), 3), 'xxx'),
|
||||
(Repeat('name', None), none_value),
|
||||
(Repeat('goes_by', 1), none_value),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue