本文整理汇总了Python中curses.KEY_F2属性的典型用法代码示例。如果您正苦于以下问题:Python curses.KEY_F2属性的具体用法?Python curses.KEY_F2怎么用?Python curses.KEY_F2使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类curses
的用法示例。
在下文中一共展示了curses.KEY_F2属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_page_cycle_theme
# 需要导入模块: import curses [as 别名]
# 或者: from curses import KEY_F2 [as 别名]
def test_page_cycle_theme(reddit, terminal, config, oauth):
page = Page(reddit, terminal, config, oauth)
page.controller = PageController(page, keymap=config.keymap)
page.term.set_theme()
assert page.term.theme.name == 'default'
with mock.patch.object(terminal, 'show_notification'), \
mock.patch.object(page, 'draw'):
# Next theme
page.controller.trigger(curses.KEY_F3)
assert page.term.theme.name == 'monochrome'
terminal.show_notification.assert_called_with(
'monochrome (built-in)', timeout=1)
# Previous theme
page.controller.trigger(curses.KEY_F2)
assert page.term.theme.name == 'default'
terminal.show_notification.assert_called_with(
'default (built-in)', timeout=1)
# Previous - will loop to one of the 256 color themes
page.controller.trigger(curses.KEY_F2)
assert page.term.theme.source in ('preset', 'installed')
# Reset
page.term.set_theme()
# Will skip over any installed themes that aren't supported
curses.has_colors.return_value = False
page.controller.trigger(curses.KEY_F2)
assert page.term.theme.required_colors == 0