code: def test_consecutive_failures_in_limit(tmp_path):
      oracle = OracleStub(
          directory=tmp_path,
          objective="val_loss",
          max_retries_per_trial=2,
      )
  
      # (1 run + 2 retry) * 2 trial = 6
      for _ in range(6):
          trial = oracle.create_trial(tuner_id="a")
          trial.status = trial_module.TrialStatus.INVALID
          trial.message = "error1"
          oracle.end_trial(trial)
  
      for _ in range(3):
          trial = oracle.create_trial(tuner_id="a")
          trial.status = trial_module.TrialStatus.COMPLETED
          oracle.update_trial(trial.trial_id, metrics={"val_loss": 0.5})
          oracle.end_trial(trial)
  
imports: import datetime
  import threading
  import time
  import numpy
  import pytest
  import keras_tuner
  from keras_tuner.engine import oracle
  from keras_tuner.engine import trial
  from keras_tuner.tuners import gridsearch
label_desc: Use image node_id 16 for calling a global function with example usage: test_consecutive_failures_in_limit(tmp_path) without return types