Пример #1
0
    def test_to_representation_returns_list_of_strings(self):
        field = MultipleEnumChoiceField(enum_class=CharTestEnum)

        result = field.to_representation(
            [CharTestEnum.FIRST, CharTestEnum.SECOND])

        self.assertEqual(['first', 'second'], result)
Пример #2
0
    def test_to_representation_returns_list_of_ints(self):
        field = MultipleEnumChoiceField(enum_class=IntTestEnum)

        result = field.to_representation(
            [IntTestEnum.FIRST, IntTestEnum.SECOND])

        self.assertEqual(['1', '2'], result)