def testCancelledStreamRequestUnaryResponse(self):
    for ((group, method), test_messages_sequence) in six.iteritems(self._digest.stream_unary_messages_sequences):
        for test_messages in test_messages_sequence:
            requests = test_messages.requests()
            callback = _Callback()
            with self._control.pause():
                response_future = self._invoker.future(group, method)(iter(requests), test_constants.LONG_TIMEOUT)
                response_future.add_done_callback(callback)
                cancel_method_return_value = response_future.cancel()
            self.assertIs(callback.future(), response_future)
            self.assertFalse(cancel_method_return_value)
            self.assertTrue(response_future.cancelled())
def testCancelledStreamRequestUnaryResponse(self):
    for ((group, method), test_messages_sequence) in six.iteritems(self._digest.stream_unary_messages_sequences):
        for test_messages in test_messages_sequence:
            requests = test_messages.requests()
            callback = _Callback()
            with self._control.pause():
                response_future = self._invoker.future(group, method)(iter(requests), test_constants.LONG_TIMEOUT)
                response_future.add_done_callback(callback)
                cancel_method_return_value = response_future.cancel()
            self.assertIs(callback.future(), response_future)
            self.assertFalse(cancel_method_return_value)
            self.assertTrue(response_future.cancelled())