本文整理汇总了Python中accessories.TestTerminal.location方法的典型用法代码示例。如果您正苦于以下问题:Python TestTerminal.location方法的具体用法?Python TestTerminal.location怎么用?Python TestTerminal.location使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类accessories.TestTerminal
的用法示例。
在下文中一共展示了TestTerminal.location方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: child_without_styling
# 需要导入模块: from accessories import TestTerminal [as 别名]
# 或者: from accessories.TestTerminal import location [as 别名]
def child_without_styling():
"""No side effect for location as a context manager without styling."""
t = TestTerminal(stream=StringIO(), force_styling=None)
with t.location(3, 4):
t.stream.write(u'hi')
assert t.stream.getvalue() == u'hi'
示例2: child
# 需要导入模块: from accessories import TestTerminal [as 别名]
# 或者: from accessories.TestTerminal import location [as 别名]
def child(kind):
buf = StringIO()
t = TestTerminal(stream=buf, force_styling=True)
y, x = 10, 20
with t.location(y, x):
xy_val = t.move(x, y)
yx_val = buf.getvalue()[len(t.sc) :]
assert xy_val == yx_val
示例3: child
# 需要导入模块: from accessories import TestTerminal [as 别名]
# 或者: from accessories.TestTerminal import location [as 别名]
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)
示例4: child_with_styling
# 需要导入模块: from accessories import TestTerminal [as 别名]
# 或者: from accessories.TestTerminal import location [as 别名]
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)