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 __enter__(self):
      self.orig_stream = getattr(sys, self.channel)
      self.buffer = MyStringIO()
      self.tee = Tee(self.buffer, channel=self.channel)
      setattr(
          sys, self.channel, self.buffer if self.suppress else self.tee
      )
  
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 2 for calling the AssertPrints obj's underlying member method code with example usage: obj.__enter__() without return types