def test_to_representation_handles_none(self): field = EnumField(enum_class=SomeEnum) value = field.to_representation(None) self.assertIsNone(value)
def test_to_representation_works(self): field = EnumField(enum_class=SomeEnum) value = field.to_representation(SomeEnum.test1) self.assertEqual(value, 'test1')