mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #34858 -- Corrected resolving output_field for PositiveIntegerField.
Regression in 40b8a6174f.
This commit is contained in:
@@ -34,6 +34,7 @@ from django.db.models import (
|
||||
Model,
|
||||
OrderBy,
|
||||
OuterRef,
|
||||
PositiveIntegerField,
|
||||
Q,
|
||||
StdDev,
|
||||
Subquery,
|
||||
@@ -2455,6 +2456,23 @@ class CombinableTests(SimpleTestCase):
|
||||
|
||||
|
||||
class CombinedExpressionTests(SimpleTestCase):
|
||||
def test_resolve_output_field_positive_integer(self):
|
||||
connectors = [
|
||||
Combinable.ADD,
|
||||
Combinable.MUL,
|
||||
Combinable.DIV,
|
||||
Combinable.MOD,
|
||||
Combinable.POW,
|
||||
]
|
||||
for connector in connectors:
|
||||
with self.subTest(connector=connector):
|
||||
expr = CombinedExpression(
|
||||
Expression(PositiveIntegerField()),
|
||||
connector,
|
||||
Expression(PositiveIntegerField()),
|
||||
)
|
||||
self.assertIsInstance(expr.output_field, PositiveIntegerField)
|
||||
|
||||
def test_resolve_output_field_number(self):
|
||||
tests = [
|
||||
(IntegerField, AutoField, IntegerField),
|
||||
|
||||
Reference in New Issue
Block a user