mirror of
https://github.com/google/flatbuffers.git
synced 2026-07-04 17:41:12 +00:00
Fix inconsistent Python union creator function naming (#8981)
This commit is contained in:
20
tests/union_name_test/my_test_union.py
Normal file
20
tests/union_name_test/my_test_union.py
Normal file
@@ -0,0 +1,20 @@
|
||||
# automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
# namespace: union_name_test
|
||||
|
||||
class my_test_union(object):
|
||||
NONE = 0
|
||||
Foo = 1
|
||||
Bar = 2
|
||||
|
||||
def MyTestUnionCreator(unionType, table):
|
||||
from flatbuffers.table import Table
|
||||
if not isinstance(table, Table):
|
||||
return None
|
||||
if unionType == my_test_union.Foo:
|
||||
import union_name_test.Foo
|
||||
return union_name_test.Foo.FooT.InitFromBuf(table.Bytes, table.Pos)
|
||||
if unionType == my_test_union.Bar:
|
||||
import union_name_test.Bar
|
||||
return union_name_test.Bar.BarT.InitFromBuf(table.Bytes, table.Pos)
|
||||
return None
|
||||
Reference in New Issue
Block a user