diff options
Diffstat (limited to 'tests/test_fields.py')
| -rw-r--r-- | tests/test_fields.py | 15 | 
1 files changed, 15 insertions, 0 deletions
| diff --git a/tests/test_fields.py b/tests/test_fields.py index 13525632..3f4e65f2 100644 --- a/tests/test_fields.py +++ b/tests/test_fields.py @@ -804,6 +804,21 @@ class TestChoiceField(FieldValues):          ]      ) +    def test_allow_blank(self): +        """ +        If `allow_blank=True` then '' is a valid input. +        """ +        field = serializers.ChoiceField( +            allow_blank=True, +            choices=[ +                ('poor', 'Poor quality'), +                ('medium', 'Medium quality'), +                ('good', 'Good quality'), +            ] +        ) +        output = field.run_validation('') +        assert output is '' +  class TestChoiceFieldWithType(FieldValues):      """ | 
