Skip to content
This repository was archived by the owner on Dec 10, 2018. It is now read-only.

Commit afd9acd

Browse files
author
misakwa
committed
Add test for recursive type
1 parent 4032763 commit afd9acd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/test_hook.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,10 @@ def test_load_slots():
130130
p_str = pickle.dumps(bob)
131131

132132
assert pickle.loads(p_str) == bob
133+
134+
# works for recursive types too
135+
rec = thriftpy.load('parser-cases/recursive_union.thrift', use_slots=True)
136+
rec_slots = rec.Dynamic.__slots__
137+
assert rec_slots == ['boolean', 'integer', 'doubl', 'str', 'arr', 'object']
138+
with pytest.raises(AttributeError):
139+
rec.Dynamic.attr_not_exist = "shouldn't work"

0 commit comments

Comments
 (0)