code: def test_xgboost_pruning_callback_call() -> None:
      # The pruner is deactivated.
      study = optuna.create_study(pruner=DeterministicPruner(False))
      trial = study.ask()
      pruning_callback = XGBoostPruningCallback(
          trial, "validation-logloss"
      )
      pruning_callback.after_iteration(
          model=None,
          epoch=1,
          evals_log={"validation": {"logloss": [1.0]}},
      )
  
      # The pruner is activated.
      study = optuna.create_study(pruner=DeterministicPruner(True))
      trial = study.ask()
      pruning_callback = XGBoostPruningCallback(
          trial, "validation-logloss"
      )
      with pytest.raises(optuna.TrialPruned):
          pruning_callback.after_iteration(
              model=None,
              epoch=1,
              evals_log={"validation": {"logloss": [1.0]}},
          )
  
file_path: optuna/tests/integration_tests/test_xgboost.py
imports: import numpy
  import pytest
  import optuna
  from optuna._imports import try_import
  from optuna.integration.xgboost import XGBoostPruningCallback
  from optuna.testing.pruners import DeterministicPruner
label_desc: Use image node_id 1 for calling a global function with example usage: test_xgboost_pruning_callback_call() without return types