mirror of
https://github.com/django/django.git
synced 2025-07-19 03:05:32 +00:00
Fixed #30095 -- Fixed system check for RangeField/ArrayField.choices with lists and tuples.
This commit is contained in:
parent
dc60597eb6
commit
47379d027b
4 changed files with 35 additions and 1 deletions
|
@ -10,7 +10,7 @@ from django.test import override_settings
|
|||
from django.utils import timezone
|
||||
|
||||
from . import PostgreSQLSimpleTestCase, PostgreSQLTestCase
|
||||
from .models import RangeLookupsModel, RangesModel
|
||||
from .models import PostgreSQLModel, RangeLookupsModel, RangesModel
|
||||
|
||||
try:
|
||||
from psycopg2.extras import DateRange, DateTimeTZRange, NumericRange
|
||||
|
@ -413,6 +413,18 @@ class TestSerialization(PostgreSQLSimpleTestCase):
|
|||
self.assertEqual(new_instance.ints, NumericRange(10, None))
|
||||
|
||||
|
||||
class TestChecks(PostgreSQLSimpleTestCase):
|
||||
def test_choices_tuple_list(self):
|
||||
class Model(PostgreSQLModel):
|
||||
field = pg_fields.IntegerRangeField(
|
||||
choices=[
|
||||
['1-50', [((1, 25), '1-25'), ([26, 50], '26-50')]],
|
||||
((51, 100), '51-100'),
|
||||
],
|
||||
)
|
||||
self.assertEqual(Model._meta.get_field('field').check(), [])
|
||||
|
||||
|
||||
class TestValidators(PostgreSQLSimpleTestCase):
|
||||
|
||||
def test_max(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue