def test_encode(self):
        encoder = pyamf.get_encoder(pyamf.AMF0)
        decoder = pyamf.get_decoder(pyamf.AMF0)
        decoder.stream = encoder.stream

        try:
            raise TypeError("Unknown type")
        except __HOLE__:
            encoder.writeElement(amf0.build_fault(*sys.exc_info()))

        buffer = encoder.stream
        buffer.seek(0, 0)

        fault = decoder.readElement()
        old_fault = amf0.build_fault(*sys.exc_info())

        self.assertEqual(fault.level, old_fault.level)
        self.assertEqual(fault.type, old_fault.type)
        self.assertEqual(fault.code, old_fault.code)
        self.assertEqual(fault.details, old_fault.details)
        self.assertEqual(fault.description, old_fault.description)
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/PyAMF-0.6.1/pyamf/tests/test_gateway.py/FaultTestCase.test_encode