code: def __init__(self, expected_warning=None, match_expr=None):
      super(WarningsChecker, self).__init__()
  
      msg = "exceptions must be old-style classes or derived from Warning, not %s"
      if isinstance(expected_warning, tuple):
          for exc in expected_warning:
              if not inspect.isclass(exc):
                  raise TypeError(msg % type(exc))
      elif inspect.isclass(expected_warning):
          expected_warning = (expected_warning,)
      elif expected_warning is not None:
          raise TypeError(msg % type(expected_warning))
  
      self.expected_warning = expected_warning
      self.match_expr = match_expr
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import inspect
  import re
  import sys
  import warnings
  import six
  import _pytest._code
  from _pytest.deprecated import PYTEST_WARNS_UNKNOWN_KWARGS
  from _pytest.deprecated import WARNS_EXEC
  from _pytest.fixtures import yield_fixture
  from _pytest.outcomes import fail
label_desc: Use image node_id 1 to create a new WarningsChecker object from inherited base classes: WarningsRecorder with example: obj = WarningsChecker(expected_warning, match_expr)