mirror of
https://github.com/godotengine/buildroot.git
synced 2026-01-04 06:10:16 +03:00
support/testing: add test for python-avro
This adds a test case for python-avro, with a script that performs a simple deserialization. Signed-off-by: Titouan Christophe <titouan.christophe@railnova.eu> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
This commit is contained in:
committed by
Yann E. MORIN
parent
9a6448a859
commit
9fa2add810
23
support/testing/tests/package/sample_python_avro.py
Normal file
23
support/testing/tests/package/sample_python_avro.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from io import BytesIO
|
||||
from avro.schema import Parse
|
||||
from avro.io import DatumReader, BinaryDecoder
|
||||
|
||||
schema = Parse("""{
|
||||
"namespace": "org.buildroot.package.python_avro",
|
||||
"type": "record",
|
||||
"name": "Developer",
|
||||
"fields": [
|
||||
{"name": "email", "type": "string"},
|
||||
{"name": "maintainer_of", "type": "string"}
|
||||
]
|
||||
}""")
|
||||
|
||||
example = b'<titouan.christophe@railnova.eu\x16python_avro'
|
||||
|
||||
reader = DatumReader(schema)
|
||||
deserialized = reader.read(BinaryDecoder(BytesIO(example)))
|
||||
|
||||
assert deserialized == {
|
||||
'email': 'titouan.christophe@railnova.eu',
|
||||
'maintainer_of': 'python_avro',
|
||||
}
|
||||
Reference in New Issue
Block a user