mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 17:47:04 +03:00
Tests & tweaks for ChoiceField
This commit is contained in:
parent
b5454dd022
commit
5a95baf2a2
|
@ -769,7 +769,9 @@ class MultipleChoiceField(ChoiceField):
|
|||
])
|
||||
|
||||
def to_representation(self, value):
|
||||
return [self.choice_strings_to_values[str(item)] for item in value]
|
||||
return set([
|
||||
self.choice_strings_to_values[str(item)] for item in value
|
||||
])
|
||||
|
||||
|
||||
# File types...
|
||||
|
|
|
@ -577,7 +577,9 @@ class TestMultipleChoiceField(FieldValues):
|
|||
'abc': ['Expected a list of items but got type `str`'],
|
||||
('aircon', 'incorrect'): ['`incorrect` is not a valid choice.']
|
||||
}
|
||||
outputs = {}
|
||||
outputs = [
|
||||
(['aircon', 'manual'], set(['aircon', 'manual']))
|
||||
]
|
||||
field = fields.MultipleChoiceField(
|
||||
choices=[
|
||||
('aircon', 'AirCon'),
|
||||
|
|
Loading…
Reference in New Issue
Block a user