diff options
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( |
