1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Fixed #31919 -- Resolved output_field of IntegerField subclasses combinations.

This commit is contained in:
Simon Charette 2020-08-30 22:25:54 -04:00 committed by Mariusz Felisiak
parent 40894f2967
commit 38fce49c82
2 changed files with 5 additions and 2 deletions

View File

@ -421,6 +421,7 @@ class Expression(BaseExpression, Combinable):
_connector_combinators = {
connector: [
(fields.IntegerField, fields.IntegerField, fields.IntegerField),
(fields.IntegerField, fields.DecimalField, fields.DecimalField),
(fields.DecimalField, fields.IntegerField, fields.DecimalField),
(fields.IntegerField, fields.FloatField, fields.FloatField),

View File

@ -9,8 +9,8 @@ from unittest import mock
from django.core.exceptions import FieldError
from django.db import DatabaseError, NotSupportedError, connection
from django.db.models import (
Avg, BinaryField, BooleanField, Case, CharField, Count, DateField,
DateTimeField, DecimalField, DurationField, Exists, Expression,
AutoField, Avg, BinaryField, BooleanField, Case, CharField, Count,
DateField, DateTimeField, DecimalField, DurationField, Exists, Expression,
ExpressionList, ExpressionWrapper, F, FloatField, Func, IntegerField, Max,
Min, Model, OrderBy, OuterRef, Q, StdDev, Subquery, Sum, TimeField,
UUIDField, Value, Variance, When,
@ -1893,6 +1893,8 @@ class CombinableTests(SimpleTestCase):
class CombinedExpressionTests(SimpleTestCase):
def test_resolve_output_field(self):
tests = [
(IntegerField, AutoField, IntegerField),
(AutoField, IntegerField, IntegerField),
(IntegerField, DecimalField, DecimalField),
(DecimalField, IntegerField, DecimalField),
(IntegerField, FloatField, FloatField),