MCPcopy Create free account
hub / github.com/apache/thrift / testComplicated

Method testComplicated

test/py/TSimpleJSONProtocolTest.py:73–104  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

71 self._assertDictEqual(expected, actual)
72
73 def testComplicated(self):
74 v2obj = VersioningTestV2(
75 begin_in_both=12345,
76 newint=1,
77 newbyte=2,
78 newshort=3,
79 newlong=4,
80 newdouble=5.0,
81 newstruct=Bonk(message="Hello!", type=123),
82 newlist=[7, 8, 9],
83 newset=set([42, 1, 8]),
84 newmap={1: 2, 2: 3},
85 newstring="Hola!",
86 end_in_both=54321)
87 expected = dict(begin_in_both=v2obj.begin_in_both,
88 newint=v2obj.newint,
89 newbyte=v2obj.newbyte,
90 newshort=v2obj.newshort,
91 newlong=v2obj.newlong,
92 newdouble=v2obj.newdouble,
93 newstruct=dict(message=v2obj.newstruct.message,
94 type=v2obj.newstruct.type),
95 newlist=v2obj.newlist,
96 newset=list(v2obj.newset),
97 newmap=v2obj.newmap,
98 newstring=v2obj.newstring,
99 end_in_both=v2obj.end_in_both)
100
101 # Need to load/dump because map keys get escaped.
102 expected = json.loads(json.dumps(expected))
103 actual = json.loads(self._serialize(v2obj).decode('ascii'))
104 self._assertDictEqual(expected, actual)
105
106
107if __name__ == '__main__':

Callers

nothing calls this directly

Calls 4

_serializeMethod · 0.95
_assertDictEqualMethod · 0.95
listFunction · 0.85
decodeMethod · 0.45

Tested by

no test coverage detected