def test_from_db_value(self): f = ChoiceEnumField(enum_type=MyChoices) self.assertEqual(f.from_db_value(0, None, None, None), MyChoices.A) self.assertEqual(f.from_db_value(1, None, None, None), MyChoices.B) self.assertEqual(f.from_db_value(2, None, None, None), 2)
def test_from_db_value(): f = ChoiceEnumField(enum_type=MyChoices) assert f.from_db_value(0, None, None, None) is MyChoices.A assert f.from_db_value(1, None, None, None) is MyChoices.B assert f.from_db_value(2, None, None, None) is 2