class_docstr: A context manager for assertLogs() and assertNoLogs() 
class_docstr_tok: ["A","context","manager","for","assertLogs","(",")","and","assertNoLogs","(",")"]
code: def __exit__(self, exc_type, exc_value, tb):
      self.logger.handlers = self.old_handlers
      self.logger.propagate = self.old_propagate
      self.logger.setLevel(self.old_level)
  
      if exc_type is not None:
          # let unexpected exceptions pass through
          return False
  
      if self.no_logs:
          # assertNoLogs
          if len(self.watcher.records) > 0:
              self._raiseFailure(
                  "Unexpected logs found: {!r}".format(
                      self.watcher.output
                  )
              )
  
      else:
          # assertLogs
          if len(self.watcher.records) == 0:
              self._raiseFailure(
                  "no logs of level {} or higher triggered on {}".format(
                      logging.getLevelName(self.level), self.logger.name
                  )
              )
  
file_path: catboost/contrib/tools/python3/src/Lib/unittest/_log.py
imports: import logging
  import collections
  from .case import _BaseTestCaseContext
label_desc: Use image node_id 3 for calling the _AssertLogsContext obj's underlying member method code with example usage: obj.__exit__(exc_type, exc_value, tb) and returns: False