code: def __exit__(self, *exc_info):
      super(WarningsChecker, self).__exit__(*exc_info)
  
      __tracebackhide__ = True
  
      # only check if we're not currently handling an exception
      if all(a is None for a in exc_info):
          if self.expected_warning is not None:
              if not any(
                  issubclass(r.category, self.expected_warning)
                  for r in self
              ):
                  __tracebackhide__ = True
                  fail(
                      "DID NOT WARN. No warnings of type {} was emitted. "
                      "The list of emitted warnings is: {}.".format(
                          self.expected_warning,
                          [each.message for each in self],
                      )
                  )
              elif self.match_expr is not None:
                  for r in self:
                      if issubclass(r.category, self.expected_warning):
                          if re.compile(self.match_expr).search(
                              str(r.message)
                          ):
                              break
                  else:
                      fail(
                          "DID NOT WARN. No warnings of type {} matching"
                          " ('{}') was emitted. The list of emitted warnings"
                          " is: {}.".format(
                              self.expected_warning,
                              self.match_expr,
                              [each.message for each in self],
                          )
                      )
  
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 2 for calling the WarningsChecker obj's underlying member method code with example usage: obj.__exit__() without return types