MCPcopy Create free account
hub / github.com/apache/qpid-proton-j / _test

Method _test

tests/python/proton_tests/codec.py:224–256  ·  view source on GitHub ↗
(self, dtype, *values, **kwargs)

Source from the content-addressed store, hash-verified

222 self._testArray("long", 0, "null")
223
224 def _test(self, dtype, *values, **kwargs):
225 eq=kwargs.get("eq", lambda x, y: x == y)
226 ntype = getattr(Data, dtype.upper())
227 putter = getattr(self.data, "put_%s" % dtype)
228 getter = getattr(self.data, "get_%s" % dtype)
229
230 for v in values:
231 self.put(putter, v)
232 gotten = getter()
233 assert eq(gotten, v), (gotten, v)
234
235 self.data.rewind()
236
237 for v in values:
238 vtype = self.data.next()
239 assert vtype == ntype, vtype
240 gotten = getter()
241 assert eq(gotten, v), (gotten, v)
242
243 encoded = self.data.encode()
244 copy = Data(0)
245 while encoded:
246 n = copy.decode(encoded)
247 encoded = encoded[n:]
248 copy.rewind()
249
250 cgetter = getattr(copy, "get_%s" % dtype)
251
252 for v in values:
253 vtype = copy.next()
254 assert vtype == ntype, vtype
255 gotten = cgetter()
256 assert eq(gotten, v), (gotten, v)
257
258 def _test_int(self, itype):
259 self._test(itype, *self.int_values(itype))

Callers 13

_test_intMethod · 0.95
testUshortMethod · 0.95
testStringMethod · 0.95
testFloatMethod · 0.95
testDoubleMethod · 0.95
testBinaryMethod · 0.95
testSymbolMethod · 0.95
testTimestampMethod · 0.95
testCharMethod · 0.95
testUUIDMethod · 0.95
testDecimal32Method · 0.95
testDecimal64Method · 0.95

Calls 9

putMethod · 0.95
decodeMethod · 0.95
rewindMethod · 0.95
nextMethod · 0.95
getMethod · 0.65
rewindMethod · 0.65
nextMethod · 0.65
encodeMethod · 0.65
DataClass · 0.50

Tested by

no test coverage detected