code: def test_trainer_event_trigger_1(
      model_and_optimizers: TrainerParameters,
      driver,
      device,
      callbacks,
      n_epochs=2,
  ):
      with pytest.raises(Exception):
          with Capturing() as output:
              trainer = Trainer(
                  model=model_and_optimizers.model,
                  driver=driver,
                  device=device,
                  optimizers=model_and_optimizers.optimizers,
                  train_dataloader=model_and_optimizers.train_dataloader,
                  evaluate_dataloaders=model_and_optimizers.evaluate_dataloaders,
                  input_mapping=model_and_optimizers.input_mapping,
                  output_mapping=model_and_optimizers.output_mapping,
                  metrics=model_and_optimizers.metrics,
                  n_epochs=n_epochs,
                  callbacks=callbacks,
              )
  
              trainer.run()
  
              if dist.is_initialized():
                  dist.destroy_process_group()
  
          Event_attrs = Event.__dict__
          for k, v in Event_attrs.items():
              if isinstance(v, staticmethod):
                  assert k in output[0]
  
file_path: fastNLP/tests/core/controllers/test_trainer_event_trigger.py
imports: import pytest
  from typing import Any
  from dataclasses import dataclass
  from fastNLP.core.controllers.trainer import Trainer
  from fastNLP.core.callbacks.callback_event import Event
  from tests.helpers.models.torch_model import TorchNormalModel_Classification_1
  from tests.helpers.datasets.torch_data import TorchNormalDataset_Classification
  from tests.helpers.callbacks.helper_callbacks import RecordTrainerEventTriggerCallback
  from tests.helpers.utils import magic_argv_env_context, Capturing
  from fastNLP.envs.imports import _NEED_IMPORT_TORCH
label_desc: Use image node_id 2 for calling a global function with example usage: test_trainer_event_trigger_1(model_and_optimizers, driver, device, callbacks, n_epochs) without return types