code: def test_hyperband_no_call_of_filter_study_in_should_prune(
      sampler_init_func: Callable[[], optuna.samplers.BaseSampler]
  ) -> None:
      def objective(trial: optuna.trial.Trial) -> float:
          with mock.patch(
              "optuna.pruners._filter_study"
          ) as method_mock:
              for i in range(N_REPORTS):
                  trial.report(i, step=i)
                  if trial.should_prune():
                      method_mock.assert_not_called()
                      raise optuna.TrialPruned()
                  else:
                      method_mock.assert_not_called()
  
          return 1.0
  
      sampler = sampler_init_func()
      pruner = optuna.pruners.HyperbandPruner(
          min_resource=MIN_RESOURCE,
          max_resource=MAX_RESOURCE,
          reduction_factor=REDUCTION_FACTOR,
      )
      study = optuna.study.create_study(sampler=sampler, pruner=pruner)
      study.optimize(objective, n_trials=10)
  
file_path: optuna/tests/pruners_tests/test_hyperband.py
imports: from typing import Callable
  from unittest import mock
  import numpy
  import pytest
  import optuna
label_desc: Use image node_id 7 for calling a global function with example usage: test_hyperband_no_call_of_filter_study_in_should_prune(sampler_init_func) and returns: int