code: def test_lightgbm_pruning_callback(cv: bool) -> None:
      study = optuna.create_study(pruner=DeterministicPruner(True))
      study.optimize(partial(objective, cv=cv), n_trials=1)
      assert study.trials[0].state == optuna.trial.TrialState.PRUNED
  
      study = optuna.create_study(pruner=DeterministicPruner(False))
      study.optimize(partial(objective, cv=cv), n_trials=1)
      assert study.trials[0].state == optuna.trial.TrialState.COMPLETE
      assert study.trials[0].value == 1.0
  
      # Use non default validation name.
      custom_valid_name = "my_validation"
      study = optuna.create_study(pruner=DeterministicPruner(False))
      study.optimize(
          lambda trial: objective(
              trial, valid_name=custom_valid_name, cv=cv
          ),
          n_trials=1,
      )
      assert study.trials[0].state == optuna.trial.TrialState.COMPLETE
      assert study.trials[0].value == 1.0
  
      # Check "maximize" direction.
      study = optuna.create_study(
          pruner=DeterministicPruner(True), direction="maximize"
      )
      study.optimize(
          lambda trial: objective(trial, metric="auc", cv=cv),
          n_trials=1,
          catch=(),
      )
      assert study.trials[0].state == optuna.trial.TrialState.PRUNED
  
      study = optuna.create_study(
          pruner=DeterministicPruner(False), direction="maximize"
      )
      study.optimize(
          lambda trial: objective(trial, metric="auc", cv=cv),
          n_trials=1,
          catch=(),
      )
      assert study.trials[0].state == optuna.trial.TrialState.COMPLETE
      assert study.trials[0].value == 1.0
  
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 2 for calling a global function with example usage: test_lightgbm_pruning_callback(cv) without return types