def test_enum_validation(self): class SomeEnum(Enum): UNO = auto() DOS = auto() TRES = auto() enum_type = EnumType(SomeEnum) enum_type.validate_value(SomeEnum.UNO)
def test_enum_json_to_value(self): class SomeOtherEnum(Enum): UNO = auto() DOS = auto() TRES = auto() enum_type = EnumType(SomeOtherEnum) enum_value = enum_type.json_to_value('DOS') self.assertEqual(enum_value, SomeOtherEnum.DOS)