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

Class MutableException

lib/py/test/test_immutable_exception.py:105–132  ·  view source on GitHub ↗

Test exception that mimics generated mutable exception behavior.

Source from the content-addressed store, hash-verified

103
104
105class MutableException(TException):
106 """Test exception that mimics generated mutable exception behavior."""
107
108 thrift_spec = (
109 None, # 0
110 (1, 11, 'message', 'UTF8', None, ), # 1: string
111 )
112
113 def __init__(self, message=None):
114 super(MutableException, self).__init__(message)
115
116 def write(self, oprot):
117 if oprot._fast_encode is not None and self.thrift_spec is not None:
118 oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
119 return
120 oprot.writeStructBegin('MutableException')
121 if self.message is not None:
122 oprot.writeFieldBegin('message', 11, 1)
123 oprot.writeString(self.message)
124 oprot.writeFieldEnd()
125 oprot.writeFieldStop()
126 oprot.writeStructEnd()
127
128 @classmethod
129 def read(cls, iprot):
130 if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and cls.thrift_spec is not None:
131 return iprot._fast_decode(None, iprot, [cls, cls.thrift_spec])
132 return iprot.readStruct(cls, cls.thrift_spec, False)
133
134
135class TestImmutableExceptionDeserialization(unittest.TestCase):

Calls

no outgoing calls