diff options
| author | Natalia <124304+nessita@users.noreply.github.com> | 2023-08-31 09:09:30 -0300 |
|---|---|---|
| committer | Natalia <124304+nessita@users.noreply.github.com> | 2023-09-14 10:15:33 -0300 |
| commit | 691f70c47755c7f55fa75ce607d028f81468b745 (patch) | |
| tree | 4d791a30d85e51c0362dfa6fb85a518758affeb5 /tests/invalid_models_tests | |
| parent | 5bfb3cbf49e2b9701e7c42989e14a72374adb6bd (diff) | |
Fixed #24561 -- Added support for callables on model fields' choices.
Diffstat (limited to 'tests/invalid_models_tests')
| -rw-r--r-- | tests/invalid_models_tests/test_ordinary_fields.py | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/tests/invalid_models_tests/test_ordinary_fields.py b/tests/invalid_models_tests/test_ordinary_fields.py index affe642ac7..ceeb254e57 100644 --- a/tests/invalid_models_tests/test_ordinary_fields.py +++ b/tests/invalid_models_tests/test_ordinary_fields.py @@ -391,26 +391,6 @@ class CharFieldTests(TestCase): ], ) - def test_choices_callable(self): - def get_choices(): - return [(i, i) for i in range(3)] - - class Model(models.Model): - field = models.CharField(max_length=10, choices=get_choices) - - field = Model._meta.get_field("field") - self.assertEqual( - field.check(), - [ - Error( - "'choices' must be a mapping (e.g. a dictionary) or an iterable " - "(e.g. a list or tuple).", - obj=field, - id="fields.E004", - ), - ], - ) - def test_bad_db_index_value(self): class Model(models.Model): field = models.CharField(max_length=10, db_index="bad") |
