From 47379d027ba2786403969367ec9c721936a823f8 Mon Sep 17 00:00:00 2001 From: Hasan Ramezani Date: Thu, 31 Oct 2019 20:33:16 +0100 Subject: Fixed #30095 -- Fixed system check for RangeField/ArrayField.choices with lists and tuples. --- tests/postgres_tests/test_array.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests/postgres_tests/test_array.py') diff --git a/tests/postgres_tests/test_array.py b/tests/postgres_tests/test_array.py index 379a1e9bba..7b7793f6c1 100644 --- a/tests/postgres_tests/test_array.py +++ b/tests/postgres_tests/test_array.py @@ -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): -- cgit v1.3