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

Function test_string

test/features/string_limit.py:31–56  ·  view source on GitHub ↗
(proto, value)

Source from the content-addressed store, hash-verified

29
30# TODO: generate from ThriftTest.thrift
31def test_string(proto, value):
32 method_name = 'testString'
33 ttype = TType.STRING
34 proto.writeMessageBegin(method_name, TMessageType.CALL, 3)
35 proto.writeStructBegin(method_name + '_args')
36 proto.writeFieldBegin('thing', ttype, 1)
37 proto.writeString(value)
38 proto.writeFieldEnd()
39 proto.writeFieldStop()
40 proto.writeStructEnd()
41 proto.writeMessageEnd()
42 proto.trans.flush()
43
44 _, mtype, _ = proto.readMessageBegin()
45 assert mtype == TMessageType.REPLY
46 proto.readStructBegin()
47 _, ftype, fid = proto.readFieldBegin()
48 assert fid == 0
49 assert ftype == ttype
50 result = proto.readString()
51 proto.readFieldEnd()
52 _, ftype, _ = proto.readFieldBegin()
53 assert ftype == TType.STOP
54 proto.readStructEnd()
55 proto.readMessageEnd()
56 assert value == result
57
58
59def main(argv):

Callers 1

mainFunction · 0.85

Calls 15

writeMessageBeginMethod · 0.65
writeStructBeginMethod · 0.65
writeFieldBeginMethod · 0.65
writeStringMethod · 0.65
writeFieldEndMethod · 0.65
writeFieldStopMethod · 0.65
writeStructEndMethod · 0.65
writeMessageEndMethod · 0.65
readMessageBeginMethod · 0.65
readStructBeginMethod · 0.65
readFieldBeginMethod · 0.65
readStringMethod · 0.65

Tested by

no test coverage detected