def testTaskqueueExceptionInHandler(self):
    self.init(__name__ + ".test_handler_yield_keys")
    # Force enqueue another task.
    parameters.config._SLICE_DURATION_SEC = 0
    TestEntity().put()
    taskqueue.Task.add = mock.MagicMock(side_effect=taskqueue.TransientError)

    # Tests that handler doesn't abort task for taskqueue errors.
    # Unfornately they still increase TaskExecutionCount.
    for _ in range(parameters.config.TASK_MAX_DATA_PROCESSING_ATTEMPTS):
      self.assertRaises(taskqueue.TransientError, self.handler.post)
    self.verify_shard_state(
        model.ShardState.get_by_shard_id(self.shard_id),
        active=True,
        processed=0)

    taskqueue.Task.add = self.original_task_add
    self.handler.post()

    self.verify_shard_state(
        model.ShardState.get_by_shard_id(self.shard_id),
        active=True,
        result_status=None,
        processed=1)
Raises an error when item is in sequence.
dataset/ETHPy150Open GoogleCloudPlatform/appengine-mapreduce/python/test/mapreduce/handlers_test.py/MapperWorkerCallbackHandlerTest.testTaskqueueExceptionInHandler--crossover with--dataset/ETHPy150Open ganeti/ganeti/qa/qa_utils.py/AssertNotIn