本文整理汇总了Python中mu.modes.microbit.MicrobitMode.fs方法的典型用法代码示例。如果您正苦于以下问题:Python MicrobitMode.fs方法的具体用法?Python MicrobitMode.fs怎么用?Python MicrobitMode.fs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mu.modes.microbit.MicrobitMode
的用法示例。
在下文中一共展示了MicrobitMode.fs方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_remove_fs_no_fs
# 需要导入模块: from mu.modes.microbit import MicrobitMode [as 别名]
# 或者: from mu.modes.microbit.MicrobitMode import fs [as 别名]
def test_remove_fs_no_fs():
"""
Removing a non-existent file system raises a RuntimeError.
"""
view = mock.MagicMock()
editor = mock.MagicMock()
mm = MicrobitMode(editor, view)
mm.fs = None
with pytest.raises(RuntimeError):
mm.remove_fs()
示例2: test_toggle_files_off
# 需要导入模块: from mu.modes.microbit import MicrobitMode [as 别名]
# 或者: from mu.modes.microbit.MicrobitMode import fs [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
示例3: test_toggle_files_on
# 需要导入模块: from mu.modes.microbit import MicrobitMode [as 别名]
# 或者: from mu.modes.microbit.MicrobitMode import fs [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_remove_fs
# 需要导入模块: from mu.modes.microbit import MicrobitMode [as 别名]
# 或者: from mu.modes.microbit.MicrobitMode import fs [as 别名]
def test_remove_fs():
"""
Removing the file system results in the expected state.
"""
view = mock.MagicMock()
view.remove_repl = mock.MagicMock()
editor = mock.MagicMock()
mm = MicrobitMode(editor, view)
mm.fs = True
mm.remove_fs()
assert view.remove_filesystem.call_count == 1
assert mm.fs is None
示例5: test_toggle_files_with_plotter
# 需要导入模块: from mu.modes.microbit import MicrobitMode [as 别名]
# 或者: from mu.modes.microbit.MicrobitMode import fs [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
示例6: test_toggle_repl_with_fs
# 需要导入模块: from mu.modes.microbit import MicrobitMode [as 别名]
# 或者: from mu.modes.microbit.MicrobitMode import fs [as 别名]
def test_toggle_repl_with_fs():
"""
If the file system is active, show a helpful message instead.
"""
view = mock.MagicMock()
view.show_message = mock.MagicMock()
editor = mock.MagicMock()
mm = MicrobitMode(editor, view)
mm.remove_repl = mock.MagicMock()
mm.repl = None
mm.fs = True
mm.toggle_repl(None)
assert view.show_message.call_count == 1
示例7: test_toggle_files_on
# 需要导入模块: from mu.modes.microbit import MicrobitMode [as 别名]
# 或者: from mu.modes.microbit.MicrobitMode import fs [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)