def test_process_enumerations_with_mixed_types(self): obj = ClassFactory.create(attrs=[ AttrFactory.create(default="aaBB"), AttrFactory.create(default=1, types=[AttrTypeFactory.xs_int()]), ]) generator.process_enumerations(obj) actual = [(attr.name, attr.default) for attr in obj.attrs] expected = [("VALUE_1", 1), ("AA_BB", '"aaBB"')] self.assertEqual(expected, actual)
def test_process_enumerations(self): obj = ClassFactory.create(attrs=[ AttrFactory.create(default="2020-12-13"), AttrFactory.create(default="2020-12-14"), ]) generator.process_enumerations(obj) actual = [(attr.name, attr.default) for attr in obj.attrs] expected = [ ("VALUE_2020_12_13", '"2020-12-13"'), ("VALUE_2020_12_14", '"2020-12-14"'), ] self.assertEqual(expected, actual)
def test_process_enumerations_with_duplicate_names(self): obj = ClassFactory.create(attrs=[ AttrFactory.create(default=3), AttrFactory.create(default=2), AttrFactory.create(default=1), AttrFactory.create(default=1), # this is removed AttrFactory.create(default="the"), AttrFactory.create(default="The"), # this is the duplicate ]) generator.process_enumerations(obj) actual = [(attr.name, attr.default) for attr in obj.attrs] expected = [ ("MQ", 1), ("MG", 2), ("MW", 3), ("IL_RO_ZSI", '"The"'), ("IN_RO_ZSI", '"the"'), ] self.assertEqual(expected, actual)