code: def test_lightgbm_pruning_callback_call(cv: bool) -> None:
      callback_env = partial(
          lgb.callback.CallbackEnv,
          model="test",
          params={},
          begin_iteration=0,
          end_iteration=1,
          iteration=1,
      )
  
      if cv:
          env = callback_env(
              evaluation_result_list=[
                  (("cv_agg", "binary_error", 1.0, False, 1.0))
              ]
          )
      else:
          env = callback_env(
              evaluation_result_list=[
                  ("validation", "binary_error", 1.0, False)
              ]
          )
  
      # The pruner is deactivated.
      study = optuna.create_study(pruner=DeterministicPruner(False))
      trial = study.ask()
      pruning_callback = LightGBMPruningCallback(
          trial, "binary_error", valid_name="validation"
      )
      pruning_callback(env)
  
      # The pruner is activated.
      study = optuna.create_study(pruner=DeterministicPruner(True))
      trial = study.ask()
      pruning_callback = LightGBMPruningCallback(
          trial, "binary_error", valid_name="validation"
      )
      with pytest.raises(optuna.TrialPruned):
          pruning_callback(env)
  
file_path: optuna/tests/integration_tests/test_lightgbm.py
imports: from functools import partial
  from unittest.mock import patch
  import numpy
  import pytest
  import optuna
  from optuna._imports import try_import
  from optuna.integration.lightgbm import LightGBMPruningCallback
  from optuna.testing.pruners import DeterministicPruner
label_desc: Use image node_id 1 for calling a global function with example usage: test_lightgbm_pruning_callback_call(cv) without return types