本文整理汇总了Python中mu.modes.debugger.DebugMode.toggle_breakpoint方法的典型用法代码示例。如果您正苦于以下问题:Python DebugMode.toggle_breakpoint方法的具体用法?Python DebugMode.toggle_breakpoint怎么用?Python DebugMode.toggle_breakpoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mu.modes.debugger.DebugMode
的用法示例。
在下文中一共展示了DebugMode.toggle_breakpoint方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_debug_toggle_breakpoint_on_existing
# 需要导入模块: from mu.modes.debugger import DebugMode [as 别名]
# 或者: from mu.modes.debugger.DebugMode import toggle_breakpoint [as 别名]
def test_debug_toggle_breakpoint_on_existing():
"""
If the breakpoint doesn't exist, create it.
"""
editor = mock.MagicMock()
view = mock.MagicMock()
dm = DebugMode(editor, view)
mock_debugger = mock.MagicMock()
dm.debugger = mock_debugger
mock_debugger.breakpoints.return_value = {}
mock_tab = mock.MagicMock()
mock_tab.path = 'foo'
mock_tab.markersAtLine.return_value = False
dm.toggle_breakpoint(0, mock_tab)
dm.debugger.create_breakpoint.assert_called_once_with(mock_tab.path, 1)
示例2: test_debug_toggle_breakpoint_on_new
# 需要导入模块: from mu.modes.debugger import DebugMode [as 别名]
# 或者: from mu.modes.debugger.DebugMode import toggle_breakpoint [as 别名]
def test_debug_toggle_breakpoint_on_new():
"""
If the breakpoint is off but disabled, enable it.
"""
editor = mock.MagicMock()
view = mock.MagicMock()
dm = DebugMode(editor, view)
mock_debugger = mock.MagicMock()
dm.debugger = mock_debugger
mock_breakpoint = mock.MagicMock()
mock_debugger.breakpoints.side_effect = [
{
1: mock_breakpoint,
},
]
mock_tab = mock.MagicMock()
mock_tab.path = 'foo'
mock_tab.markersAtLine.return_value = False
dm.toggle_breakpoint(0, mock_tab)
dm.debugger.enable_breakpoint.assert_called_once_with(mock_breakpoint)
示例3: test_debug_toggle_breakpoint_off_no_breakpoint
# 需要导入模块: from mu.modes.debugger import DebugMode [as 别名]
# 或者: from mu.modes.debugger.DebugMode import toggle_breakpoint [as 别名]
def test_debug_toggle_breakpoint_off_no_breakpoint():
"""
If a breakpoint appears on a line, but it's not actually been created in
the debug runner process (perhaps because the breakpoint was created after
the process finished but before the stop button was created) then it's
toggled off with no further side-effects.
"""
editor = mock.MagicMock()
view = mock.MagicMock()
dm = DebugMode(editor, view)
mock_debugger = mock.MagicMock()
dm.debugger = mock_debugger
mock_debugger.breakpoints.side_effect = [
{}
]
mock_tab = mock.MagicMock()
mock_tab.path = 'foo'
mock_tab.markersAtLine.return_value = True
dm.toggle_breakpoint(0, mock_tab)
mock_debugger.breakpoints.assert_called_once_with(mock_tab.path)
mock_tab.markersAtLine.assert_called_once_with(0)
assert mock_debugger.disable_breakpoint.call_count == 0
mock_tab.markerDelete.assert_called_once_with(0,
mock_tab.BREAKPOINT_MARKER)
示例4: test_debug_toggle_breakpoint_off
# 需要导入模块: from mu.modes.debugger import DebugMode [as 别名]
# 或者: from mu.modes.debugger.DebugMode import toggle_breakpoint [as 别名]
def test_debug_toggle_breakpoint_off():
"""
If a breakpoint is on, it's toggled off.
"""
editor = mock.MagicMock()
view = mock.MagicMock()
dm = DebugMode(editor, view)
mock_debugger = mock.MagicMock()
dm.debugger = mock_debugger
mock_breakpoint = mock.MagicMock()
mock_debugger.breakpoints.side_effect = [
{
1: mock_breakpoint,
},
]
mock_tab = mock.MagicMock()
mock_tab.path = 'foo'
mock_tab.markersAtLine.return_value = True
dm.toggle_breakpoint(0, mock_tab)
mock_debugger.breakpoints.assert_called_once_with(mock_tab.path)
mock_tab.markersAtLine.assert_called_once_with(0)
mock_debugger.disable_breakpoint.assert_called_once_with(mock_breakpoint)
mock_tab.markerDelete.assert_called_once_with(0,
mock_tab.BREAKPOINT_MARKER)