def test_fmt(self): print(pp.pformat("asdf")) print(pp.fmt("stuff")) self.assertStdout(""" 'asdf' 'stuff' """)
def decorator(msg, *args, **kwargs): pretty_msg = "Func: %s\n" % get_prev_method_name() if type(msg) == str: pretty_msg += msg else: pretty_msg += pp.fmt(msg) pretty_msg += "\n+ " + "- " * 30 + "+\n" func(pretty_msg, *args, **kwargs)
import pp pp(["hello", "world"]) pp.pprint("stuff") print pp.pformat("asdf") print pp.fmt("stuff") print dir(pp) print repr(pp)
def cmd_expect(self, expected): actual = pp.fmt(self.cmd_result()) # expected = repr(' '.join(parts)) if actual != expected: raise RuntimeError('Expected {!r}, got {!r}'.format( expected, actual))