def test_field_to_python_value_is_encoded_string(self):
     """Widget may return encoded string as value for key in POST"""
     ff = SelectMultipleFormField()
     for i, v in enumerate(self.choices_list):
         subset = self.choices_list[0: i]
         encoded = encode_list_to_csv(subset)
         self.assertEqual(ff.to_python(encoded), sorted(subset))
 def test_field_to_python_value_is_empty_string(self):
     """Widget may return empty string as value for key in POST"""
     ff = SelectMultipleFormField()
     self.assertEqual(ff.to_python(''), [])
 def test_field_to_python_value_is_simple_string(self):
     """Widget may return simple string as value for key in POST"""
     ff = SelectMultipleFormField()
     simple = self.choices_list[1]
     self.assertEqual(ff.to_python(simple), [simple])
 def test_field_to_python_value_is_none(self):
     """Widget may return None as value for missing key in POST"""
     ff = SelectMultipleFormField()
     self.assertEqual(ff.to_python(None), [])