def child(kind, lines=25, cols=80): # set the pty's virtual window size val = struct.pack('HHHH', lines, cols, 0, 0) fcntl.ioctl(sys.__stdout__.fileno(), termios.TIOCSWINSZ, val) term = TestTerminal(kind=kind) pony_msg = 'pony express, all aboard, choo, choo!' pony_len = len(pony_msg) pony_colored = u''.join([ '%s%s' % ( term.color(n % 7), ch, ) for n, ch in enumerate(pony_msg) ]) pony_colored += term.normal ladjusted = term.ljust(pony_colored) radjusted = term.rjust(pony_colored) centered = term.center(pony_colored) assert (term.length(pony_colored) == pony_len) assert (term.length(centered.strip()) == pony_len) assert (term.length(centered) == len(pony_msg.center(term.width))) assert (term.length(ladjusted.strip()) == pony_len) assert (term.length(ladjusted) == len(pony_msg.ljust(term.width))) assert (term.length(radjusted.strip()) == pony_len) assert (term.length(radjusted) == len(pony_msg.rjust(term.width)))
def child(kind): t = TestTerminal(kind=kind) pony_msg = "pony express, all aboard, choo, choo!" pony_len = len(pony_msg) pony_colored = u"".join(["%s%s" % (t.color(n % 7), ch) for n, ch in enumerate(pony_msg)]) pony_colored += t.normal ladjusted = t.ljust(pony_colored, 88) radjusted = t.rjust(pony_colored, 88) centered = t.center(pony_colored, 88) assert t.length(pony_colored) == pony_len assert t.length(centered.strip()) == pony_len assert t.length(centered) == len(pony_msg.center(88)) assert t.length(ladjusted.strip()) == pony_len assert t.length(ladjusted) == len(pony_msg.ljust(88)) assert t.length(radjusted.strip()) == pony_len assert t.length(radjusted) == len(pony_msg.rjust(88))
def child(kind): term = TestTerminal(kind=kind) pony_msg = 'pony express, all aboard, choo, choo!' pony_len = len(pony_msg) pony_colored = u''.join( ['%s%s' % (term.color(n % 7), ch,) for n, ch in enumerate(pony_msg)]) pony_colored += term.normal ladjusted = term.ljust(pony_colored, 88) radjusted = term.rjust(pony_colored, 88) centered = term.center(pony_colored, 88) assert (term.length(pony_colored) == pony_len) assert (term.length(centered.strip()) == pony_len) assert (term.length(centered) == len(pony_msg.center(88))) assert (term.length(ladjusted.strip()) == pony_len) assert (term.length(ladjusted) == len(pony_msg.ljust(88))) assert (term.length(radjusted.strip()) == pony_len) assert (term.length(radjusted) == len(pony_msg.rjust(88)))
def child(kind, lines=25, cols=80): # set the pty's virtual window size val = struct.pack("HHHH", lines, cols, 0, 0) fcntl.ioctl(sys.__stdout__.fileno(), termios.TIOCSWINSZ, val) t = TestTerminal(kind=kind) pony_msg = "pony express, all aboard, choo, choo!" pony_len = len(pony_msg) pony_colored = u"".join(["%s%s" % (t.color(n % 7), ch) for n, ch in enumerate(pony_msg)]) pony_colored += t.normal ladjusted = t.ljust(pony_colored) radjusted = t.rjust(pony_colored) centered = t.center(pony_colored) assert t.length(pony_colored) == pony_len assert t.length(centered.strip()) == pony_len assert t.length(centered) == len(pony_msg.center(t.width)) assert t.length(ladjusted.strip()) == pony_len assert t.length(ladjusted) == len(pony_msg.ljust(t.width)) assert t.length(radjusted.strip()) == pony_len assert t.length(radjusted) == len(pony_msg.rjust(t.width))
def child(kind): term = TestTerminal(kind=kind) pony_msg = 'pony express, all aboard, choo, choo!' pony_len = len(pony_msg) pony_colored = u''.join([ '%s%s' % ( term.color(n % 7), ch, ) for n, ch in enumerate(pony_msg) ]) pony_colored += term.normal ladjusted = term.ljust(pony_colored, 88) radjusted = term.rjust(pony_colored, 88) centered = term.center(pony_colored, 88) assert (term.length(pony_colored) == pony_len) assert (term.length(centered.strip()) == pony_len) assert (term.length(centered) == len(pony_msg.center(88))) assert (term.length(ladjusted.strip()) == pony_len) assert (term.length(ladjusted) == len(pony_msg.ljust(88))) assert (term.length(radjusted.strip()) == pony_len) assert (term.length(radjusted) == len(pony_msg.rjust(88)))