mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +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
|
@ -592,6 +592,20 @@ class TestChecks(PostgreSQLSimpleTestCase):
|
|||
self.assertEqual(errors[0].id, 'postgres.E001')
|
||||
self.assertIn('max_length', errors[0].msg)
|
||||
|
||||
def test_choices_tuple_list(self):
|
||||
class MyModel(PostgreSQLModel):
|
||||
field = ArrayField(
|
||||
models.CharField(max_length=16),
|
||||
choices=[
|
||||
[
|
||||
'Media',
|
||||
[(['vinyl', 'cd'], 'Audio'), (('vhs', 'dvd'), 'Video')],
|
||||
],
|
||||
(['mp3', 'mp4'], 'Digital'),
|
||||
],
|
||||
)
|
||||
self.assertEqual(MyModel._meta.get_field('field').check(), [])
|
||||
|
||||
|
||||
@unittest.skipUnless(connection.vendor == 'postgresql', "PostgreSQL specific tests")
|
||||
class TestMigrations(TransactionTestCase):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue