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

Method do_test

test/py/FastbinaryTest.py:159–203  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

157 raise Exception('read value mismatch')
158
159 def do_test(self):
160 self._check_write(HolyMoley())
161 self._check_read(HolyMoley())
162
163 self._check_write(hm)
164 no_set = deepcopy(hm)
165 no_set.contain = set()
166 self._check_read(no_set)
167 self._check_read(hm)
168
169 self._check_write(rs)
170 self._check_read(rs)
171
172 self._check_write(rshuge)
173 self._check_read(rshuge)
174
175 self._check_write(my_zero)
176 self._check_read(my_zero)
177
178 self._check_read(Backwards(**{"first_tag2": 4, "second_tag1": 2}))
179
180 # One case where the serialized form changes, but only superficially.
181 o = Backwards(**{"first_tag2": 4, "second_tag1": 2})
182 trans_fast = TTransport.TMemoryBuffer()
183 trans_slow = TTransport.TMemoryBuffer()
184 prot_fast = self._fast(trans_fast, fallback=False)
185 prot_slow = self._slow(trans_slow)
186
187 o.write(prot_fast)
188 o.write(prot_slow)
189 ORIG = trans_slow.getvalue()
190 MINE = trans_fast.getvalue()
191 assert id(ORIG) != id(MINE)
192
193 prot = self._fast(TTransport.TMemoryBuffer(), fallback=False)
194 o.write(prot)
195 prot = self._slow(
196 TTransport.TMemoryBuffer(prot.trans.getvalue()))
197 c = o.__class__()
198 c.read(prot)
199 if c != o:
200 print("copy: ")
201 pprint(repr(c))
202 print("orig: ")
203 pprint(repr(o))
204
205
206def do_test(fast, slow):

Callers 1

do_testFunction · 0.80

Calls 6

_check_writeMethod · 0.95
_check_readMethod · 0.95
getvalueMethod · 0.95
writeMethod · 0.65
readMethod · 0.65
TMemoryBufferMethod · 0.45

Tested by

no test coverage detected