Tests & tweaks for ChoiceField

This commit is contained in:
Tom Christie 2014-09-22 16:52:57 +01:00
parent b5454dd022
commit 5a95baf2a2
2 changed files with 6 additions and 2 deletions

View File

@ -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...

View File

@ -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'),