当前位置: 首页>>代码示例>>Python>>正文


Python MicrobitMode.repl方法代码示例

本文整理汇总了Python中mu.modes.microbit.MicrobitMode.repl方法的典型用法代码示例。如果您正苦于以下问题:Python MicrobitMode.repl方法的具体用法?Python MicrobitMode.repl怎么用?Python MicrobitMode.repl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mu.modes.microbit.MicrobitMode的用法示例。


在下文中一共展示了MicrobitMode.repl方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_add_fs_with_repl

# 需要导入模块: from mu.modes.microbit import MicrobitMode [as 别名]
# 或者: from mu.modes.microbit.MicrobitMode import repl [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
开发者ID:lordmauve,项目名称:mu,代码行数:13,代码来源:test_microbit.py

示例2: test_toggle_repl

# 需要导入模块: from mu.modes.microbit import MicrobitMode [as 别名]
# 或者: from mu.modes.microbit.MicrobitMode import repl [as 别名]
def test_toggle_repl():
    """
    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)
    with mock.patch('mu.modes.microbit.MicroPythonMode.toggle_repl') as tr:
        mm.repl = None
        mm.toggle_repl(None)
        tr.assert_called_once_with(None)
开发者ID:lordmauve,项目名称:mu,代码行数:14,代码来源:test_microbit.py

示例3: test_toggle_files_off

# 需要导入模块: from mu.modes.microbit import MicrobitMode [as 别名]
# 或者: from mu.modes.microbit.MicrobitMode import repl [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
开发者ID:lordmauve,项目名称:mu,代码行数:14,代码来源:test_microbit.py

示例4: test_toggle_files_on

# 需要导入模块: from mu.modes.microbit import MicrobitMode [as 别名]
# 或者: from mu.modes.microbit.MicrobitMode import repl [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
开发者ID:lordmauve,项目名称:mu,代码行数:14,代码来源:test_microbit.py

示例5: test_toggle_repl_with_fs

# 需要导入模块: from mu.modes.microbit import MicrobitMode [as 别名]
# 或者: from mu.modes.microbit.MicrobitMode import repl [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
开发者ID:lordmauve,项目名称:mu,代码行数:15,代码来源:test_microbit.py

示例6: test_toggle_files_with_repl

# 需要导入模块: from mu.modes.microbit import MicrobitMode [as 别名]
# 或者: from mu.modes.microbit.MicrobitMode import repl [as 别名]
def test_toggle_files_with_repl():
    """
    If the REPL is active, ensure a helpful message is displayed.
    """
    view = mock.MagicMock()
    view.show_message = mock.MagicMock()
    editor = mock.MagicMock()
    mm = MicrobitMode(editor, view)
    mm.add_repl = mock.MagicMock()
    mm.repl = True
    mm.fs = None
    mm.toggle_files(None)
    assert view.show_message.call_count == 1
开发者ID:lordmauve,项目名称:mu,代码行数:15,代码来源:test_microbit.py

示例7: test_toggle_repl

# 需要导入模块: from mu.modes.microbit import MicrobitMode [as 别名]
# 或者: from mu.modes.microbit.MicrobitMode import repl [as 别名]
def test_toggle_repl():
    """
    Ensure the REPL is able to toggle on if there's no file system pane.
    """
    view = mock.MagicMock()
    view.show_message = mock.MagicMock()
    editor = mock.MagicMock()
    mm = MicrobitMode(editor, view)

    def side_effect(*args, **kwargs):
        mm.repl = True

    with mock.patch('mu.modes.microbit.MicroPythonMode.toggle_repl',
                    side_effect=side_effect) as tr:
        mm.repl = None
        mm.toggle_repl(None)
        tr.assert_called_once_with(None)
        view.button_bar.slots['files'].\
            setEnabled.assert_called_once_with(False)
开发者ID:willingc,项目名称:mu,代码行数:21,代码来源:test_microbit.py

示例8: test_toggle_repl_no_repl_or_plotter

# 需要导入模块: from mu.modes.microbit import MicrobitMode [as 别名]
# 或者: from mu.modes.microbit.MicrobitMode import repl [as 别名]
def test_toggle_repl_no_repl_or_plotter():
    """
    Ensure the file system button is enabled if the repl toggles off and the
    plotter isn't active.
    """
    view = mock.MagicMock()
    view.show_message = mock.MagicMock()
    editor = mock.MagicMock()
    mm = MicrobitMode(editor, view)

    def side_effect(*args, **kwargs):
        mm.repl = False
        mm.plotter = False

    with mock.patch('mu.modes.microbit.MicroPythonMode.toggle_repl',
                    side_effect=side_effect) as tr:
        mm.repl = None
        mm.toggle_repl(None)
        tr.assert_called_once_with(None)
        view.button_bar.slots['files'].\
            setEnabled.assert_called_once_with(True)
开发者ID:willingc,项目名称:mu,代码行数:23,代码来源:test_microbit.py

示例9: test_toggle_files_on

# 需要导入模块: from mu.modes.microbit import MicrobitMode [as 别名]
# 或者: from mu.modes.microbit.MicrobitMode import repl [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)
开发者ID:willingc,项目名称:mu,代码行数:24,代码来源:test_microbit.py


注:本文中的mu.modes.microbit.MicrobitMode.repl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。