diff options
| author | Tom Christie | 2014-09-22 16:52:57 +0100 | 
|---|---|---|
| committer | Tom Christie | 2014-09-22 16:52:57 +0100 | 
| commit | 5a95baf2a2258fb5297062ac18582129c05fb320 (patch) | |
| tree | dae81912497c57de52a094b077b9be7bdb5f3d0f | |
| parent | b5454dd02290130a7fb0a0e375f3efecc58edc6d (diff) | |
| download | django-rest-framework-5a95baf2a2258fb5297062ac18582129c05fb320.tar.bz2 | |
Tests & tweaks for ChoiceField
| -rw-r--r-- | rest_framework/fields.py | 4 | ||||
| -rw-r--r-- | tests/test_fields.py | 4 | 
2 files changed, 6 insertions, 2 deletions
| diff --git a/rest_framework/fields.py b/rest_framework/fields.py index 500018f3..80eadf1e 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -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... diff --git a/tests/test_fields.py b/tests/test_fields.py index 3343123f..3cfc1b88 100644 --- a/tests/test_fields.py +++ b/tests/test_fields.py @@ -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'), | 
