From 96ee097bd68a93e0f360326271ebe78553fae15b Mon Sep 17 00:00:00 2001 From: Simon Charette Date: Sat, 8 Nov 2025 16:40:26 -0500 Subject: Refs #31055 -- Adjusted passing of Field.check kwargs to ArrayField.base_field. This was missed when Field.check(databases) was introduced. --- tests/postgres_tests/test_array.py | 19 +++++++++++++++++++ 1 file changed, 19 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 f35211e8ed..d4289d79df 100644 --- a/tests/postgres_tests/test_array.py +++ b/tests/postgres_tests/test_array.py @@ -841,6 +841,25 @@ class TestChecks(PostgreSQLSimpleTestCase): self.assertEqual(errors[0].id, "postgres.E001") self.assertIn("max_length", errors[0].msg) + def test_base_field_check_kwargs(self): + passed_kwargs = None + + class MyField(models.Field): + def check(self, **kwargs): + nonlocal passed_kwargs + passed_kwargs = kwargs + return [] + + class MyModel(PostgreSQLModel): + field = ArrayField(MyField()) + + self.assertEqual(MyModel.check(databases=["default"]), []) + self.assertEqual( + passed_kwargs, + {"databases": ["default"]}, + "ArrayField.check kwargs should be passed to its base_field.", + ) + def test_invalid_base_fields(self): class MyModel(PostgreSQLModel): field = ArrayField( -- cgit v1.3