code: def test_param_scheduler_attach_warning():
      trainer = Engine(lambda e, b: None)
      param_name = "state_param"
      save_history = True
      create_new = False
  
      param_scheduler = PiecewiseLinearStateScheduler(
          param_name=param_name,
          milestones_values=[(0, 0.0), (10, 0.999)],
          save_history=save_history,
          create_new=create_new,
      )
  
      with pytest.warns(
          UserWarning,
          match=r"Attribute '"
          + re.escape(param_name)
          + "' is not defined in the engine.state. "
          r"PiecewiseLinearStateScheduler will create it. Remove this warning by setting create_new=True.",
      ):
          param_scheduler.attach(trainer, Events.ITERATION_COMPLETED)
  
imports: import re
  from pathlib import Path
  from unittest.mock import patch
  import pytest
  import torch
  import torch.nn
  from packaging.version import Version
  from ignite.engine import Engine, Events
  from ignite.handlers.state_param_scheduler import ExpStateScheduler, LambdaStateScheduler, MultiStepStateScheduler, PiecewiseLinearStateScheduler, StepStateScheduler
  from bisect import bisect_right
label_desc: Use image node_id 18 for calling a global function with example usage: test_param_scheduler_attach_warning() without return types