mirror of
https://github.com/django/django.git
synced 2025-10-25 06:36:07 +00:00
Fixed #34388 -- Allowed using choice enumeration types directly on model and form fields.
This commit is contained in:
committed by
Mariusz Felisiak
parent
051d5944f8
commit
a2eaea8f22
@@ -301,11 +301,11 @@ class ValidationTests(SimpleTestCase):
|
||||
f.clean("0", None)
|
||||
|
||||
def test_enum_choices_cleans_valid_string(self):
|
||||
f = models.IntegerField(choices=self.Choices.choices)
|
||||
f = models.IntegerField(choices=self.Choices)
|
||||
self.assertEqual(f.clean("1", None), 1)
|
||||
|
||||
def test_enum_choices_invalid_input(self):
|
||||
f = models.IntegerField(choices=self.Choices.choices)
|
||||
f = models.IntegerField(choices=self.Choices)
|
||||
with self.assertRaises(ValidationError):
|
||||
f.clean("A", None)
|
||||
with self.assertRaises(ValidationError):
|
||||
|
||||
Reference in New Issue
Block a user