hunk.code_window:         """
           side_frame = "-" * 79
           message = _wrap_lines(message)
           self.outfile.write(
               "{line}{frame}{line}{msg}{line}{frame}{line}".format(
                   line=os.linesep, frame=side_frame, msg=message))
  
hunk.labels: keep keep keep replace keep keep keep
hunk.after_edit:         if wrap:
               message = _wrap_lines(message)
  
hunk.file_path: certbot/display/util.py
hunk.type: replace
file: """Tests for certbot.colored_logging."""
  import logging
  import unittest
  
  import six
  
  from certbot import util
  
  
  class StreamHandlerTest(unittest.TestCase):
      """Tests for certbot.colored_logging."""
  
      def setUp(self):
          from certbot import colored_logging
  
          self.stream = six.StringIO()
          self.stream.isatty = lambda: True
          self.handler = colored_logging.StreamHandler(self.stream)
  
          self.logger = logging.getLogger()
          self.logger.setLevel(logging.DEBUG)
          self.logger.addHandler(self.handler)
  
      def test_format(self):
          msg = 'I did a thing'
          self.logger.debug(msg)
          self.assertEqual(self.stream.getvalue(), '{0}\n'.format(msg))
  
      def test_format_and_red_level(self):
          msg = 'I did another thing'
          self.handler.red_level = logging.DEBUG
          self.logger.debug(msg)
  
          self.assertEqual(self.stream.getvalue(),
                           '{0}{1}{2}\n'.format(util.ANSI_SGR_RED,
                                                msg,
                                                util.ANSI_SGR_RESET))
  
  
  if __name__ == "__main__":
      unittest.main()  # pragma: no cover
  