本文整理汇总了Python中mu.modes.python3.PythonMode.repl方法的典型用法代码示例。如果您正苦于以下问题:Python PythonMode.repl方法的具体用法?Python PythonMode.repl怎么用?Python PythonMode.repl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mu.modes.python3.PythonMode
的用法示例。
在下文中一共展示了PythonMode.repl方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_python_add_plotter
# 需要导入模块: from mu.modes.python3 import PythonMode [as 别名]
# 或者: from mu.modes.python3.PythonMode import repl [as 别名]
def test_python_add_plotter():
"""
Ensure the plotter is added as expected.
"""
editor = mock.MagicMock()
view = mock.MagicMock()
pm = PythonMode(editor, view)
pm.set_buttons = mock.MagicMock()
pm.add_plotter()
view.add_python3_plotter.assert_called_once_with(pm)
assert pm.plotter
pm.set_buttons.assert_called_once_with(debug=False)
# Check button states are updated depending on other aspects of the mode
# being enabled.
# REPL active.
pm.set_buttons.reset_mock()
pm.repl = True
pm.add_plotter()
assert pm.set_buttons.call_count == 2
assert pm.set_buttons.call_args_list[0][1]['debug'] is False
assert pm.set_buttons.call_args_list[1][1]['run'] is False
# Runner active.
pm.set_buttons.reset_mock()
pm.repl = False
pm.runner = True
pm.add_plotter()
assert pm.set_buttons.call_count == 2
assert pm.set_buttons.call_args_list[0][1]['debug'] is False
assert pm.set_buttons.call_args_list[1][1]['repl'] is False