THRIFT-3596 Better conformance to PEP8
This closes #832
diff --git a/test/features/theader_binary.py b/test/features/theader_binary.py
index 62a2671..02e010b 100644
--- a/test/features/theader_binary.py
+++ b/test/features/theader_binary.py
@@ -14,57 +14,57 @@
def test_void(proto):
- proto.writeMessageBegin('testVoid', TMessageType.CALL, 3)
- proto.writeStructBegin('testVoid_args')
- proto.writeFieldStop()
- proto.writeStructEnd()
- proto.writeMessageEnd()
- proto.trans.flush()
+ proto.writeMessageBegin('testVoid', TMessageType.CALL, 3)
+ proto.writeStructBegin('testVoid_args')
+ proto.writeFieldStop()
+ proto.writeStructEnd()
+ proto.writeMessageEnd()
+ proto.trans.flush()
- _, mtype, _ = proto.readMessageBegin()
- assert mtype == TMessageType.REPLY
- proto.readStructBegin()
- _, ftype, _ = proto.readFieldBegin()
- assert ftype == TType.STOP
- proto.readStructEnd()
- proto.readMessageEnd()
+ _, mtype, _ = proto.readMessageBegin()
+ assert mtype == TMessageType.REPLY
+ proto.readStructBegin()
+ _, ftype, _ = proto.readFieldBegin()
+ assert ftype == TType.STOP
+ proto.readStructEnd()
+ proto.readMessageEnd()
# THeader stack should accept binary protocol with optionally framed transport
def main(argv):
- p = argparse.ArgumentParser()
- add_common_args(p)
- # Since THeaderTransport acts as framed transport when detected frame, we
- # cannot use --transport=framed as it would result in 2 layered frames.
- p.add_argument('--override-transport')
- p.add_argument('--override-protocol')
- args = p.parse_args()
- assert args.protocol == 'header'
- assert args.transport == 'buffered'
- assert not args.ssl
+ p = argparse.ArgumentParser()
+ add_common_args(p)
+ # Since THeaderTransport acts as framed transport when detected frame, we
+ # cannot use --transport=framed as it would result in 2 layered frames.
+ p.add_argument('--override-transport')
+ p.add_argument('--override-protocol')
+ args = p.parse_args()
+ assert args.protocol == 'header'
+ assert args.transport == 'buffered'
+ assert not args.ssl
- sock = TSocket(args.host, args.port, socket_family=socket.AF_INET)
- if not args.override_transport or args.override_transport == 'buffered':
- trans = TBufferedTransport(sock)
- elif args.override_transport == 'framed':
- print('TFRAMED')
- trans = TFramedTransport(sock)
- else:
- raise ValueError('invalid transport')
- trans.open()
+ sock = TSocket(args.host, args.port, socket_family=socket.AF_INET)
+ if not args.override_transport or args.override_transport == 'buffered':
+ trans = TBufferedTransport(sock)
+ elif args.override_transport == 'framed':
+ print('TFRAMED')
+ trans = TFramedTransport(sock)
+ else:
+ raise ValueError('invalid transport')
+ trans.open()
- if not args.override_protocol or args.override_protocol == 'binary':
- proto = TBinaryProtocol(trans)
- elif args.override_protocol == 'compact':
- proto = TCompactProtocol(trans)
- else:
- raise ValueError('invalid transport')
+ if not args.override_protocol or args.override_protocol == 'binary':
+ proto = TBinaryProtocol(trans)
+ elif args.override_protocol == 'compact':
+ proto = TCompactProtocol(trans)
+ else:
+ raise ValueError('invalid transport')
- test_void(proto)
- test_void(proto)
+ test_void(proto)
+ test_void(proto)
- trans.close()
+ trans.close()
if __name__ == '__main__':
- sys.exit(main(sys.argv[1:]))
+ sys.exit(main(sys.argv[1:]))