diff options
| author | Simon Charette <charette.s@gmail.com> | 2025-11-08 16:40:26 -0500 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2025-11-13 10:28:59 +0100 |
| commit | 96ee097bd68a93e0f360326271ebe78553fae15b (patch) | |
| tree | 20c841ec35d69bbede4aea3dbe0c2c2dffae4db4 /tests/postgres_tests | |
| parent | 1b539ef27e776bd6112e8f22e653feca5279c4fb (diff) | |
Refs #31055 -- Adjusted passing of Field.check kwargs to ArrayField.base_field.
This was missed when Field.check(databases) was introduced.
Diffstat (limited to 'tests/postgres_tests')
| -rw-r--r-- | tests/postgres_tests/test_array.py | 19 |
1 files changed, 19 insertions, 0 deletions
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( |
