diff options
| author | T. Franzel <tfranzel@users.noreply.github.com> | 2023-03-11 00:34:13 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-03-21 19:44:41 +0100 |
| commit | a2eaea8f22305b57dff3ab13add2e2887287bb6f (patch) | |
| tree | a2f1acee503899e52a583572a46aeee0d1a5432c /tests/model_fields/tests.py | |
| parent | 051d5944f86400b9b3476db60bc73de7e9964810 (diff) | |
Fixed #34388 -- Allowed using choice enumeration types directly on model and form fields.
Diffstat (limited to 'tests/model_fields/tests.py')
| -rw-r--r-- | tests/model_fields/tests.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/model_fields/tests.py b/tests/model_fields/tests.py index 6d4a91afa2..fe8526a480 100644 --- a/tests/model_fields/tests.py +++ b/tests/model_fields/tests.py @@ -156,6 +156,7 @@ class ChoicesTests(SimpleTestCase): cls.empty_choices_bool = Choiceful._meta.get_field("empty_choices_bool") cls.empty_choices_text = Choiceful._meta.get_field("empty_choices_text") cls.with_choices = Choiceful._meta.get_field("with_choices") + cls.choices_from_enum = Choiceful._meta.get_field("choices_from_enum") def test_choices(self): self.assertIsNone(self.no_choices.choices) @@ -192,6 +193,10 @@ class ChoicesTests(SimpleTestCase): with self.subTest(field=field): self.assertIsInstance(field.formfield(), forms.ChoiceField) + def test_choices_from_enum(self): + # Choices class was transparently resolved when given as argument. + self.assertEqual(self.choices_from_enum.choices, Choiceful.Suit.choices) + class GetFieldDisplayTests(SimpleTestCase): def test_choices_and_field_display(self): |
