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

Commit

Permalink
Merge pull request #59 from maralla/set
Browse files Browse the repository at this point in the history
support set
  • Loading branch information
hit9 committed Nov 1, 2014
2 parents 574b911 + f598126 commit bb11d1d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/test_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from thriftpy import load
from thriftpy.thrift import TType


def test_set():
s = load("type.thrift")

assert s.Set.thrift_spec == {1: (TType.SET, "a_set", TType.STRING)}
3 changes: 3 additions & 0 deletions tests/type.thrift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
struct Set {
1: required set<string> a_set
}
2 changes: 2 additions & 0 deletions thriftpy/parser/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ def _ttype(t, module=None):
return getattr(TType, t.upper())
elif t[0] == "list":
return TType.LIST, _ttype(t[1])
elif t[0] == "set":
return TType.SET, _ttype(t[1])
elif t[0] == "map":
return TType.MAP, (_ttype(t[1]), _ttype(t[2]))
else:
Expand Down

0 comments on commit bb11d1d

Please sign in to comment.