def test_otherErrors(self):
"""
If there is an exception other than L{client.PotentialDataLoss} while
L{client.readBody} is collecting the response body, the L{Deferred}
returned by {client.readBody} fires with that exception.
"""
response = DummyResponse()
d = client.readBody(response)
response.protocol.dataReceived(b"first")
response.protocol.connectionLost(
Failure(ConnectionLost("mystery problem")))
reason = self.failureResultOf(d)
reason.trap(ConnectionLost)
self.assertEqual(reason.value.args, ("mystery problem",))
评论列表
文章目录