예제 #1
0
 def test_format_object(self, _format):
     x = ColorFormatter()
     x.use_color = True
     record = Mock()
     record.levelname = 'ERROR'
     record.msg = object()
     assert x.format(record)
예제 #2
0
 def test_format_raises_no_color(self, safe_str):
     x = ColorFormatter(use_color=False)
     record = Mock()
     record.levelname = 'ERROR'
     record.msg = 'HELLO'
     record.exc_text = 'error text'
     x.format(record)
     assert safe_str.call_count == 1