本文整理汇总了Python中accessories.TestTerminal.cuf方法的典型用法代码示例。如果您正苦于以下问题:Python TestTerminal.cuf方法的具体用法?Python TestTerminal.cuf怎么用?Python TestTerminal.cuf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类accessories.TestTerminal
的用法示例。
在下文中一共展示了TestTerminal.cuf方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: child_mnemonics_willmove
# 需要导入模块: from accessories import TestTerminal [as 别名]
# 或者: from accessories.TestTerminal import cuf [as 别名]
def child_mnemonics_willmove(kind):
from blessed.sequences import measure_length
t = TestTerminal(kind=kind)
# movements
assert (len(t.move(98, 76)) ==
measure_length(t.move(98, 76), t))
assert (len(t.move(54)) ==
measure_length(t.move(54), t))
assert not t.cud1 or (len(t.cud1) ==
measure_length(t.cud1, t))
assert not t.cub1 or (len(t.cub1) ==
measure_length(t.cub1, t))
assert not t.cuf1 or (len(t.cuf1) ==
measure_length(t.cuf1, t))
assert not t.cuu1 or (len(t.cuu1) ==
measure_length(t.cuu1, t))
assert not t.cub or (len(t.cub(333)) ==
measure_length(t.cub(333), t))
assert not t.cuf or (len(t.cuf(333)) ==
measure_length(t.cuf(333), t))
assert not t.home or (len(t.home) ==
measure_length(t.home, t))
assert not t.restore or (len(t.restore) ==
measure_length(t.restore, t))
assert not t.clear or (len(t.clear) ==
measure_length(t.clear, t))
示例2: child_mnemonics_wontmove
# 需要导入模块: from accessories import TestTerminal [as 别名]
# 或者: from accessories.TestTerminal import cuf [as 别名]
def child_mnemonics_wontmove(kind):
from blessed.sequences import measure_length
t = TestTerminal(kind=kind)
assert (0 == measure_length(u'', t))
# not even a mbs
assert (0 == measure_length(u'xyzzy', t))
# negative numbers, though printable as %d, do not result
# in movement; just garbage. Also not a valid sequence.
assert (0 == measure_length(t.cuf(-333), t))
assert (len(t.clear_eol) == measure_length(t.clear_eol, t))
# various erases don't *move*
assert (len(t.clear_bol) == measure_length(t.clear_bol, t))
assert (len(t.clear_eos) == measure_length(t.clear_eos, t))
assert (len(t.bold) == measure_length(t.bold, t))
# various paints don't move
assert (len(t.red) == measure_length(t.red, t))
assert (len(t.civis) == measure_length(t.civis, t))
if t.cvvis:
assert (len(t.cvvis) == measure_length(t.cvvis, t))
assert (len(t.underline) == measure_length(t.underline, t))
assert (len(t.reverse) == measure_length(t.reverse, t))
for _num in range(t.number_of_colors):
assert (len(t.color(_num)) == measure_length(t.color(_num), t))
assert (len(t.normal) == measure_length(t.normal, t))
assert (len(t.normal_cursor) == measure_length(t.normal_cursor, t))
assert (len(t.hide_cursor) == measure_length(t.hide_cursor, t))
assert (len(t.save) == measure_length(t.save, t))
assert (len(t.italic) == measure_length(t.italic, t))
assert (len(t.standout) == measure_length(t.standout, t)
), (t.standout, t._wont_move)
示例3: child
# 需要导入模块: from accessories import TestTerminal [as 别名]
# 或者: from accessories.TestTerminal import cuf [as 别名]
#.........这里部分代码省略.........
if t.underline:
assert (t.length(t.underline) == 0)
assert (t.length(t.underline(u'x')) == 1)
assert (t.length(t.underline_red) == 0)
assert (t.length(t.underline_red(u'x')) == 1)
assert (t.strip(t.underline) == u'')
assert (t.strip(t.underline(u' x ')) == u'x')
assert (t.strip(t.underline_red) == u'')
assert (t.strip(t.underline_red(u' x ')) == u'x')
assert (t.rstrip(t.underline_red(u' x ')) == u' x')
assert (t.lstrip(t.underline_red(u' x ')) == u'x ')
assert (t.strip_seqs(t.underline) == u'')
assert (t.strip_seqs(t.underline(u' x ')) == u' x ')
assert (t.strip_seqs(t.underline_red) == u'')
assert (t.strip_seqs(t.underline_red(u' x ')) == u' x ')
if t.reverse:
assert (t.length(t.reverse) == 0)
assert (t.length(t.reverse(u'x')) == 1)
assert (t.length(t.reverse_red) == 0)
assert (t.length(t.reverse_red(u'x')) == 1)
assert (t.strip(t.reverse) == u'')
assert (t.strip(t.reverse(u' x ')) == u'x')
assert (t.strip(t.reverse_red) == u'')
assert (t.strip(t.reverse_red(u' x ')) == u'x')
assert (t.rstrip(t.reverse_red(u' x ')) == u' x')
assert (t.lstrip(t.reverse_red(u' x ')) == u'x ')
assert (t.strip_seqs(t.reverse) == u'')
assert (t.strip_seqs(t.reverse(u' x ')) == u' x ')
assert (t.strip_seqs(t.reverse_red) == u'')
assert (t.strip_seqs(t.reverse_red(u' x ')) == u' x ')
if t.blink:
assert (t.length(t.blink) == 0)
assert (t.length(t.blink(u'x')) == 1)
assert (t.length(t.blink_red) == 0)
assert (t.length(t.blink_red(u'x')) == 1)
assert (t.strip(t.blink) == u'')
assert (t.strip(t.blink(u' x ')) == u'x')
assert (t.strip(t.blink(u'z x q'), u'zq') == u' x ')
assert (t.strip(t.blink_red) == u'')
assert (t.strip(t.blink_red(u' x ')) == u'x')
assert (t.strip_seqs(t.blink) == u'')
assert (t.strip_seqs(t.blink(u' x ')) == u' x ')
assert (t.strip_seqs(t.blink_red) == u'')
assert (t.strip_seqs(t.blink_red(u' x ')) == u' x ')
if t.home:
assert (t.length(t.home) == 0)
assert (t.strip(t.home) == u'')
if t.clear_eol:
assert (t.length(t.clear_eol) == 0)
assert (t.strip(t.clear_eol) == u'')
if t.enter_fullscreen:
assert (t.length(t.enter_fullscreen) == 0)
assert (t.strip(t.enter_fullscreen) == u'')
if t.exit_fullscreen:
assert (t.length(t.exit_fullscreen) == 0)
assert (t.strip(t.exit_fullscreen) == u'')
# horizontally, we decide move_down and move_up are 0,
assert (t.length(t.move_down) == 0)
assert (t.length(t.move_down(2)) == 0)
assert (t.length(t.move_up) == 0)
assert (t.length(t.move_up(2)) == 0)
# other things aren't so simple, somewhat edge cases,
# moving backwards and forwards horizontally must be
# accounted for as a "length", as <x><move right 10><y>
# will result in a printed column length of 12 (even
# though columns 2-11 are non-destructive space
assert (t.length(u'x\b') == 0)
assert (t.strip(u'x\b') == u'')
# XXX why are some terminals width of 9 here ??
assert (t.length(u'\t') in (8, 9))
assert (t.strip(u'\t') == u'')
assert (t.length(u'_' + t.move_left) == 0)
if t.cub:
assert (t.length((u'_' * 10) + t.cub(10)) == 0)
assert (t.length(t.move_right) == 1)
if t.cuf:
assert (t.length(t.cuf(10)) == 10)
# vertical spacing is unaccounted as a 'length'
assert (t.length(t.move_up) == 0)
assert (t.length(t.cuu(10)) == 0)
assert (t.length(t.move_down) == 0)
assert (t.length(t.cud(10)) == 0)
# this is how manpages perform underlining, this is done
# with the 'overstrike' capability of teletypes, and aparently
# less(1), '123' -> '1\b_2\b_3\b_'
text_wseqs = u''.join(itertools.chain(
*zip(plain_text, itertools.cycle(['\b_']))))
assert (t.length(text_wseqs) == len(plain_text))