def test_enum(self): test_schema = schema.EnumSchema('test_enum', None, ['A', 'B'], schema.Names()) self.assertEquals(self.converter.to_json_object('A', test_schema), 'A') self.assertEquals(self.converter.from_json_object('B', test_schema), 'B')
def create_enum_schema(self, name, symbols, aliases=None): return schema.EnumSchema(name, self.test_namespace, symbols, names=schema.Names(), other_props={'aliases': aliases})
def testSymbolsInReverseOrder(self): enum = schema.EnumSchema('Test', '', ['B', 'A'], schema.Names(), '', {}) self.assertEqual('B', enum.symbols[0])
def test_enum(self): names = schema.Names() enum_schema = schema.EnumSchema("test", "test", ['a', 'b'], names=names) b = object(enum_schema, 'b') node = bamboo_cpp.convert_avro(b) self.assertListEqual(node.get_list().get_values().tolist(), ['b'])