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

Commit

Permalink
Add test for recursive type
Browse files Browse the repository at this point in the history
  • Loading branch information
misakwa committed Nov 22, 2016
1 parent 4032763 commit afd9acd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/test_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,10 @@ def test_load_slots():
p_str = pickle.dumps(bob)

assert pickle.loads(p_str) == bob

# works for recursive types too
rec = thriftpy.load('parser-cases/recursive_union.thrift', use_slots=True)
rec_slots = rec.Dynamic.__slots__
assert rec_slots == ['boolean', 'integer', 'doubl', 'str', 'arr', 'object']
with pytest.raises(AttributeError):
rec.Dynamic.attr_not_exist = "shouldn't work"

0 comments on commit afd9acd

Please sign in to comment.