コード例 #1
0
    def test_to_representation_handles_none(self):

        field = EnumField(enum_class=SomeEnum)

        value = field.to_representation(None)

        self.assertIsNone(value)
コード例 #2
0
    def test_to_representation_works(self):

        field = EnumField(enum_class=SomeEnum)

        value = field.to_representation(SomeEnum.test1)

        self.assertEqual(value, 'test1')