code: def test_load_state_dict_asserts():
      engine = Engine(lambda e, b: 1)
  
      with pytest.raises(
          TypeError, match=r"Argument state_dict should be a dictionary"
      ):
          engine.load_state_dict("123")
  
      with pytest.raises(
          ValueError, match=r"is absent in provided state_dict"
      ):
          engine.load_state_dict({})
  
      with pytest.raises(
          ValueError, match=r"state_dict should contain only one of"
      ):
          engine.load_state_dict(
              {"max_epochs": 100, "epoch_length": 120}
          )
  
      with pytest.raises(
          ValueError, match=r"state_dict should contain only one of"
      ):
          engine.load_state_dict(
              {
                  "max_epochs": 100,
                  "epoch_length": 120,
                  "iteration": 12,
                  "epoch": 123,
              }
          )
  
      engine = Engine(lambda e, b: 1)
      engine.state_dict_user_keys.append("alpha")
      with pytest.raises(
          ValueError, match=r"Required user state attribute"
      ):
          engine.load_state_dict(
              {"max_epochs": 100, "epoch_length": 120, "iteration": 12}
          )
  
      engine = Engine(lambda e, b: 1)
      with pytest.raises(
          ValueError,
          match=r"If epoch is provided in the state dict, epoch_length should not be None",
      ):
          engine.load_state_dict(
              {"max_epochs": 100, "epoch": 2, "epoch_length": None}
          )
  
file_path: ignite/tests/ignite/engine/test_engine_state_dict.py
imports: from collections.abc import Mapping
  import pytest
  import torch
  from ignite.engine import Engine, Events, State
  from tests.ignite.engine import BatchChecker, EpochCounter, IterationCounter
label_desc: Use image node_id 4 for calling a global function with example usage: test_load_state_dict_asserts() without return types