class_docstr: Context manager for testing that code prints certain text.
  
  Examples
  --------
  >>> with AssertPrints("abc", suppress=False):
  ...     print("abcd")
  ...     print("def")
  ... 
  abcd
  def
class_docstr_tok: ["Context","manager","for","testing","that","code","prints","certain","text",".","Examples","--","--","--","--",">",">",">","with","AssertPrints","(","``","abc","''",",","suppress=False",")",":","...","print","(","``","abcd","''",")","...","print","(","``","def","''",")","...","abcd","def"]
code: def __exit__(self, etype, value, traceback):
      try:
          if value is not None:
              # If an error was raised, don't check anything else
              return False
          self.tee.flush()
          setattr(sys, self.channel, self.orig_stream)
          printed = self.buffer.getvalue()
          for s in self.s:
              if isinstance(s, _re_type):
                  assert s.search(printed), notprinted_msg.format(
                      s.pattern, self.channel, printed
                  )
              else:
                  assert s in printed, notprinted_msg.format(
                      s, self.channel, printed
                  )
          return False
      finally:
          self.tee.close()
  
imports: from __future__ import absolute_import
  import os
  import re
  import sys
  import tempfile
  from contextlib import contextmanager
  from io import StringIO
  from subprocess import Popen, PIPE
  from traitlets.config.loader import Config
  from IPython.utils.process import get_output_error_code
  from IPython.utils.text import list_strings
  from IPython.utils.io import temp_pyfile, Tee
  from IPython.utils import py3compat
  from IPython.utils.encoding import DEFAULT_ENCODING
  from .None import decorators
  from .None import skipdoctest
label_desc: Use image node_id 3 for calling the AssertPrints obj's underlying member method code with example usage: obj.__exit__(etype, value, traceback) and returns: False, False