def child(kind): t = TestTerminal(kind=kind, stream=StringIO(), force_styling=True) with t.location(0, 0): pass expected_output = u''.join( (unicode_cap('sc'), unicode_parm('cup', 0, 0), unicode_cap('rc'))) assert (t.stream.getvalue() == expected_output)
def child_with_styling(kind): t = TestTerminal(kind=kind, stream=StringIO(), force_styling=True) with t.location(3, 4): t.stream.write(u'hi') expected_output = u''.join( (unicode_cap('sc'), unicode_parm('cup', 4, 3), u'hi', unicode_cap('rc'))) assert (t.stream.getvalue() == expected_output)
def child(kind): t = TestTerminal(kind=kind, stream=StringIO(), force_styling=True) ROW = 5 with t.location(y=ROW): pass expected_output = u''.join( (unicode_cap('sc'), u'\x1b[{0}d'.format(ROW + 1), unicode_cap('rc'))) assert (t.stream.getvalue() == expected_output)
def child(): # Also test that Terminal grabs a reasonable default stream. This test # assumes it will be run from a tty. t = TestTerminal() sc = unicode_cap('sc') assert t.save == sc assert t.save == sc # Make sure caching doesn't screw it up.
def child(): t = TestTerminal(stream=StringIO(), force_styling=True) assert t.save == unicode_cap('sc')
def child(kind): t = TestTerminal(stream=StringIO(), force_styling=True) with t.location(): pass expected_output = u"".join((unicode_cap("sc"), unicode_cap("rc"))) assert t.stream.getvalue() == expected_output