本文整理匯總了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