def test_output_includes_strings(self):
     # The string (or strings) provided as *args are included in the
     # output.
     stream = StringIO.StringIO()
     COLOR = 'some escape sequence'
     MESSAGES = ('message1', 'message2')
     print_with_color(COLOR, *MESSAGES, out=stream)
     for message in MESSAGES:
         self.assertIn(message, stream.getvalue())
 def test_output_includes_strings(self):
     # The string (or strings) provided as *args are included in the
     # output.
     stream = StringIO.StringIO()
     COLOR = 'some escape sequence'
     MESSAGES = ('message1', 'message2')
     print_with_color(COLOR, *MESSAGES, out=stream)
     for message in MESSAGES:
         self.assertIn(message, stream.getvalue())
 def test_color_is_reset_after_message(self):
     # The color is reset to normal after the message is output.
     stream = StringIO.StringIO()
     COLOR = 'some escape sequence'
     print_with_color(COLOR, 'message', out=stream)
     self.assertTrue(stream.getvalue().endswith(NORMAL))
 def test_output_is_prefixed_with_color(self):
     # The escape sequence to generate the color is output first.
     stream = StringIO.StringIO()
     COLOR = 'some escape sequence'
     print_with_color(COLOR, 'message', out=stream)
     self.assertTrue(stream.getvalue().startswith(COLOR))
 def test_color_is_reset_after_message(self):
     # The color is reset to normal after the message is output.
     stream = StringIO.StringIO()
     COLOR = 'some escape sequence'
     print_with_color(COLOR, 'message', out=stream)
     self.assertTrue(stream.getvalue().endswith(NORMAL))
 def test_output_is_prefixed_with_color(self):
     # The escape sequence to generate the color is output first.
     stream = StringIO.StringIO()
     COLOR = 'some escape sequence'
     print_with_color(COLOR, 'message', out=stream)
     self.assertTrue(stream.getvalue().startswith(COLOR))