本文整理汇总了Python中mu.modes.microbit.MicrobitMode.plotter方法的典型用法代码示例。如果您正苦于以下问题:Python MicrobitMode.plotter方法的具体用法?Python MicrobitMode.plotter怎么用?Python MicrobitMode.plotter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mu.modes.microbit.MicrobitMode
的用法示例。
在下文中一共展示了MicrobitMode.plotter方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_toggle_files_with_plotter
# 需要导入模块: from mu.modes.microbit import MicrobitMode [as 别名]
# 或者: from mu.modes.microbit.MicrobitMode import plotter [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
示例2: test_toggle_plotter_with_fs
# 需要导入模块: from mu.modes.microbit import MicrobitMode [as 别名]
# 或者: from mu.modes.microbit.MicrobitMode import plotter [as 别名]
def test_toggle_plotter_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_plotter = mock.MagicMock()
mm.plotter = None
mm.fs = True
mm.toggle_plotter(None)
assert view.show_message.call_count == 1
示例3: test_toggle_plotter
# 需要导入模块: from mu.modes.microbit import MicrobitMode [as 别名]
# 或者: from mu.modes.microbit.MicrobitMode import plotter [as 别名]
def test_toggle_plotter():
"""
Ensure the plotter is toggled on if the file system pane is absent.
"""
view = mock.MagicMock()
view.show_message = mock.MagicMock()
editor = mock.MagicMock()
mm = MicrobitMode(editor, view)
def side_effect(*args, **kwargs):
mm.plotter = True
with mock.patch('mu.modes.microbit.MicroPythonMode.toggle_plotter',
side_effect=side_effect) as tp:
mm.plotter = None
mm.toggle_plotter(None)
tp.assert_called_once_with(None)
view.button_bar.slots['files'].\
setEnabled.assert_called_once_with(False)
示例4: test_toggle_plotter_no_repl_or_plotter
# 需要导入模块: from mu.modes.microbit import MicrobitMode [as 别名]
# 或者: from mu.modes.microbit.MicrobitMode import plotter [as 别名]
def test_toggle_plotter_no_repl_or_plotter():
"""
Ensure the file system button is enabled if the plotter toggles off and the
repl isn't active.
"""
view = mock.MagicMock()
view.show_message = mock.MagicMock()
editor = mock.MagicMock()
mm = MicrobitMode(editor, view)
def side_effect(*args, **kwargs):
mm.plotter = False
mm.repl = False
with mock.patch('mu.modes.microbit.MicroPythonMode.toggle_plotter',
side_effect=side_effect) as tp:
mm.plotter = None
mm.toggle_plotter(None)
tp.assert_called_once_with(None)
view.button_bar.slots['files'].\
setEnabled.assert_called_once_with(True)