def _test__indentation_different_char(self, through_constructor): if through_constructor: self.f = Formatter(self.buff, indentation_string='*') indenter = self.f.indented else: indenter = lambda indentation: self.f.indented(indentation, string='*') self.f.writeln("a") with indenter(2): self.f.writeln('b') self.f.writeln('c') self.assertOutput('a\n**b\nc\n')
def test_color_string_tty(self): self.buff.isatty().whenever().and_return(True) s = ColorString("hello", "red") self.buff.write(s.get_colored()) self.forge.replay() Formatter(self.buff).write(s)
def setUp(self): super(FormatterTest, self).setUp() self.buff = StringIO() self.f = Formatter(self.buff)