(self)
| 44 | self.assertEqual(protocol.readString(), unicode_text) |
| 45 | |
| 46 | def test_TJSONProtocol_write(self): |
| 47 | write_data = '{"software":"thrift","1":[23,1.2010000000000001,32767,2147483647,9223372036854775807],"base64":"aGVsbG8gdGhyaWZ0","bool":0}' |
| 48 | |
| 49 | buff = TTransport.TMemoryBuffer() |
| 50 | transport = TTransport.TBufferedTransportFactory().getTransport(buff) |
| 51 | protocol = TJSONProtocol(transport) |
| 52 | protocol.writeJSONObjectStart() |
| 53 | protocol.writeJSONString("software") |
| 54 | protocol.writeJSONString("thrift") |
| 55 | protocol.writeJSONString("1") |
| 56 | protocol.writeJSONArrayStart() |
| 57 | protocol.writeJSONNumber(23) |
| 58 | protocol.writeDouble(1.201) |
| 59 | protocol.writeI16(32767) |
| 60 | protocol.writeI32(2147483647) |
| 61 | protocol.writeI64(9223372036854775807) |
| 62 | protocol.writeJSONArrayEnd() |
| 63 | protocol.writeJSONString("base64") |
| 64 | protocol.writeJSONBase64("hello thrift".encode('utf-8')) |
| 65 | protocol.writeJSONString("bool") |
| 66 | protocol.writeBool(0) |
| 67 | protocol.writeJSONObjectEnd() |
| 68 | |
| 69 | transport.flush() |
| 70 | value = buff.getvalue() |
| 71 | |
| 72 | self.assertEqual(write_data, value.decode('utf-8')) |
| 73 | |
| 74 | def test_TJSONProtol_read(self): |
| 75 | expected = "{'software':'thrift','1':[23,1.2010000000000001,32767,2147483647,9223372036854775807],'base64':'hello thrift','bool':False}" |
nothing calls this directly
no test coverage detected