当前位置: 首页>>代码示例>>Python>>正文


Python TestTerminal.underline_red方法代码示例

本文整理汇总了Python中accessories.TestTerminal.underline_red方法的典型用法代码示例。如果您正苦于以下问题:Python TestTerminal.underline_red方法的具体用法?Python TestTerminal.underline_red怎么用?Python TestTerminal.underline_red使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在accessories.TestTerminal的用法示例。


在下文中一共展示了TestTerminal.underline_red方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: child

# 需要导入模块: from accessories import TestTerminal [as 别名]
# 或者: from accessories.TestTerminal import underline_red [as 别名]
    def child(kind):
        t = TestTerminal(kind=kind)
        # Create a list of ascii characters, to be separated
        # by word, to be zipped up with a cycling list of
        # terminal sequences. Then, compare the length of
        # each, the basic plain_text.__len__ vs. the Terminal
        # method length. They should be equal.
        plain_text = (u'The softest things of the world '
                      u'Override the hardest things of the world '
                      u'That which has no substance '
                      u'Enters into that which has no openings')
        if t.bold:
            assert (t.length(t.bold) == 0)
            assert (t.length(t.bold(u'x')) == 1)
            assert (t.length(t.bold_red) == 0)
            assert (t.length(t.bold_red(u'x')) == 1)
            assert (t.strip(t.bold) == u'')
            assert (t.rstrip(t.bold) == u'')
            assert (t.lstrip(t.bold) == u'')
            assert (t.strip(t.bold(u'  x  ')) == u'x')
            assert (t.strip(t.bold(u'z  x  q'), 'zq') == u'  x  ')
            assert (t.rstrip(t.bold(u'  x  ')) == u'  x')
            assert (t.lstrip(t.bold(u'  x  ')) == u'x  ')
            assert (t.strip(t.bold_red) == u'')
            assert (t.rstrip(t.bold_red) == u'')
            assert (t.lstrip(t.bold_red) == u'')
            assert (t.strip(t.bold_red(u'  x  ')) == u'x')
            assert (t.rstrip(t.bold_red(u'  x  ')) == u'  x')
            assert (t.lstrip(t.bold_red(u'  x  ')) == u'x  ')
            assert (t.strip_seqs(t.bold) == u'')
            assert (t.strip_seqs(t.bold(u'  x  ')) == u'  x  ')
            assert (t.strip_seqs(t.bold_red) == u'')
            assert (t.strip_seqs(t.bold_red(u'  x  ')) == u'  x  ')

        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)

#.........这里部分代码省略.........
开发者ID:lowks,项目名称:blessed,代码行数:103,代码来源:test_length_sequence.py


注:本文中的accessories.TestTerminal.underline_red方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。