本文整理汇总了Python中mu.modes.microbit.MicrobitMode.add_fs方法的典型用法代码示例。如果您正苦于以下问题:Python MicrobitMode.add_fs方法的具体用法?Python MicrobitMode.add_fs怎么用?Python MicrobitMode.add_fs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mu.modes.microbit.MicrobitMode
的用法示例。
在下文中一共展示了MicrobitMode.add_fs方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_add_fs_with_repl
# 需要导入模块: from mu.modes.microbit import MicrobitMode [as 别名]
# 或者: from mu.modes.microbit.MicrobitMode import add_fs [as 别名]
def test_add_fs_with_repl():
"""
If the REPL is active, you can't add the file system pane.
"""
view = mock.MagicMock()
editor = mock.MagicMock()
mm = MicrobitMode(editor, view)
mm.repl = True
with mock.patch('mu.modes.microbit.microfs.get_serial', return_value=True):
mm.add_fs()
assert view.add_filesystem.call_count == 0
示例2: test_add_fs_no_device
# 需要导入模块: from mu.modes.microbit import MicrobitMode [as 别名]
# 或者: from mu.modes.microbit.MicrobitMode import add_fs [as 别名]
def test_add_fs_no_device():
"""
If there's no device attached then ensure a helpful message is displayed.
"""
view = mock.MagicMock()
view.show_message = mock.MagicMock()
ex = IOError('BOOM')
editor = mock.MagicMock()
mm = MicrobitMode(editor, view)
with mock.patch('mu.modes.microbit.microfs.get_serial', side_effect=ex):
mm.add_fs()
assert view.show_message.call_count == 1
示例3: test_add_fs_no_repl
# 需要导入模块: from mu.modes.microbit import MicrobitMode [as 别名]
# 或者: from mu.modes.microbit.MicrobitMode import add_fs [as 别名]
def test_add_fs_no_repl():
"""
It's possible to add the file system pane if the REPL is inactive.
"""
view = mock.MagicMock()
editor = mock.MagicMock()
mm = MicrobitMode(editor, view)
with mock.patch('mu.modes.microbit.FileManager') as mock_fm,\
mock.patch('mu.modes.microbit.QThread'),\
mock.patch('mu.modes.microbit.microfs.get_serial',
return_value=True):
mm.add_fs()
workspace = mm.workspace_dir()
view.add_filesystem.assert_called_once_with(workspace, mock_fm())
assert mm.fs
示例4: test_toggle_files_on
# 需要导入模块: from mu.modes.microbit import MicrobitMode [as 别名]
# 或者: from mu.modes.microbit.MicrobitMode import add_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
示例5: test_toggle_files_on
# 需要导入模块: from mu.modes.microbit import MicrobitMode [as 别名]
# 或者: from mu.modes.microbit.MicrobitMode import add_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)