本文整理汇总了Python中mu.modes.microbit.MicrobitMode.toggle_files方法的典型用法代码示例。如果您正苦于以下问题:Python MicrobitMode.toggle_files方法的具体用法?Python MicrobitMode.toggle_files怎么用?Python MicrobitMode.toggle_files使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mu.modes.microbit.MicrobitMode
的用法示例。
在下文中一共展示了MicrobitMode.toggle_files方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_toggle_files_off
# 需要导入模块: from mu.modes.microbit import MicrobitMode [as 别名]
# 或者: from mu.modes.microbit.MicrobitMode import toggle_files [as 别名]
def test_toggle_files_off():
"""
If the fs is on, toggle if off.
"""
view = mock.MagicMock()
editor = mock.MagicMock()
mm = MicrobitMode(editor, view)
mm.remove_fs = mock.MagicMock()
mm.repl = None
mm.fs = True
mm.toggle_files(None)
assert mm.remove_fs.call_count == 1
示例2: test_toggle_files_with_plotter
# 需要导入模块: from mu.modes.microbit import MicrobitMode [as 别名]
# 或者: from mu.modes.microbit.MicrobitMode import toggle_files [as 别名]
def test_toggle_files_with_plotter():
"""
If the plotter is active, ensure a helpful message is displayed.
"""
view = mock.MagicMock()
view.show_message = mock.MagicMock()
editor = mock.MagicMock()
mm = MicrobitMode(editor, view)
mm.plotter = True
mm.fs = None
mm.toggle_files(None)
assert view.show_message.call_count == 1
示例3: test_toggle_files_on
# 需要导入模块: from mu.modes.microbit import MicrobitMode [as 别名]
# 或者: from mu.modes.microbit.MicrobitMode import toggle_files [as 别名]
def test_toggle_files_on():
"""
If the fs is off, toggle it on.
"""
view = mock.MagicMock()
editor = mock.MagicMock()
mm = MicrobitMode(editor, view)
mm.add_fs = mock.MagicMock()
mm.repl = None
mm.fs = None
mm.toggle_files(None)
assert mm.add_fs.call_count == 1
示例4: test_toggle_files_on
# 需要导入模块: from mu.modes.microbit import MicrobitMode [as 别名]
# 或者: from mu.modes.microbit.MicrobitMode import toggle_files [as 别名]
def test_toggle_files_on():
"""
If the fs is off, toggle it on.
"""
view = mock.MagicMock()
view.button_bar.slots = {
'repl': mock.MagicMock(),
'plotter': mock.MagicMock(),
}
editor = mock.MagicMock()
mm = MicrobitMode(editor, view)
def side_effect(*args, **kwargs):
mm.fs = True
mm.add_fs = mock.MagicMock(side_effect=side_effect)
mm.repl = None
mm.fs = None
mm.toggle_files(None)
assert mm.add_fs.call_count == 1
view.button_bar.slots['repl'].setEnabled.assert_called_once_with(False)
view.button_bar.slots['plotter'].setEnabled.assert_called_once_with(False)