twisted.web.http.PotentialDataLoss

Here are the examples of the python api twisted.web.http.PotentialDataLoss taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

Example 1

Project: treq Source File: test_content.py
    def test_collect_failure_potential_data_loss(self):
        """
        PotentialDataLoss failures are treated as success.
        """
        data = []

        d = collect(self.response, data.append)

        self.protocol.dataReceived(b'foo')

        self.protocol.connectionLost(Failure(PotentialDataLoss()))

        self.assertEqual(self.successResultOf(d), None)

        self.assertEqual(data, [b'foo'])

Example 2

Project: twitty-twister Source File: test_streaming.py
    def test_closedPotentialDataLoss(self):
        """
        When the connection is done, the deferred is fired.
        """
        self.protocol.connectionLost(failure.Failure(PotentialDataLoss()))
        return self.protocol.deferred