code: def assert_warns(expected):
      with warnings.catch_warnings(record=True) as w:
          warnings.simplefilter("always")
          yield
  
      if any(isinstance(m.message, expected) for m in w):
          return
  
      try:
          exc_name = expected.__name__
      except AttributeError:
          exc_name = str(expected)
  
      raise AssertionError("%s not triggerred" % exc_name)
  
imports: import contextlib
  import inspect
  from typing import Callable
  import unittest
  from unittest import mock
  import warnings
  import numpy
  import cupy
  from cupy._core import internal
  import cupyx
  import cupyx.scipy.sparse
  from cupy.testing._pytest_impl import is_available
label_desc: Use image node_id 9 for calling a global function with example usage: assert_warns(expected) without return types