def test_short_types(self): short_int = Integer(size=4) self.assertEquals(short_int.avro_type_name, 'int') long_int = Integer() self.assertEquals(long_int.avro_type_name, 'long') short_float = Float(size=4) self.assertEquals(short_float.avro_type_name, 'float') long_float = Float() self.assertEquals(long_float.avro_type_name, 'double')
class MyItem(Record): name = Text() value = Integer() dec = Float() flag = Boolean() date = Date() datehour = DateTime()
class SomeAvroRecord(Record): """SomeAvroRecord contains a lot of cool stuff""" a = Text() b = Integer() c = Bytes() d = Boolean() e = Float(description="hello world!") f = Enum(["FOO", "bar"]) g = List(Text(), nullable=True) h = List(SubRecord(TextRecord)) i = Map(Text(), nullable=True) j = Map(SubRecord(TextRecord)) k = Date() l = DateTime() m = Text(nullable=False) n = Integer(nullable=False) o = Bytes(nullable=False) p = Boolean(nullable=False) q = Float(nullable=False) r = Enum(["FOO", "bar"], nullable=False) s = SubRecord(TextRecord, nullable=False) t = SubRecord(TextRecord2, nullable=False) u = SubRecord(TextRecord3)
class OutputRecord(pyschema.Record): foo = Text() barsum = Integer()
class InputRecord(pyschema.Record): foo = Text() bar = Integer()
class ValidRecord(pyschema.Record): field = Integer()
class Inner(Record): field = Integer()
class FooRecord(pyschema.Record): foo = Text() bar = Integer()