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


Python DebugMode.toggle_breakpoint方法代码示例

本文整理汇总了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)
开发者ID:ZanderBrown,项目名称:mu,代码行数:17,代码来源:test_debug.py

示例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)
开发者ID:ZanderBrown,项目名称:mu,代码行数:22,代码来源:test_debug.py

示例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)
开发者ID:ZanderBrown,项目名称:mu,代码行数:26,代码来源:test_debug.py

示例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)
开发者ID:ZanderBrown,项目名称:mu,代码行数:26,代码来源:test_debug.py


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