def test_debug_on_stack(): """ Ensure the expected locals dict is passed to the view so the object inspector is updated properly. """ editor = mock.MagicMock() view = mock.MagicMock() dm = DebugMode(editor, view) stack = [ ( 1, { 'locals': { 'a': 'frame1', 'b': 'frame1', } } ), ( 2, { 'locals': { 'b': 'frame2', 'c': 'frame2', } } ) ] dm.debug_on_stack(stack) view.update_debug_inspector.assert_called_once_with({ 'a': 'frame1', 'b': 'frame2', 'c': 'frame2', })
def test_debug_on_stack(): """ Ensure the expected locals dict is passed to the view so the object inspector is updated properly. """ editor = mock.MagicMock() view = mock.MagicMock() dm = DebugMode(editor, view) stack = [ (1, { "locals": { "a": "frame1", "b": "frame1" } }), (2, { "locals": { "b": "frame2", "c": "frame2" } }), ] dm.debug_on_stack(stack) view.update_debug_inspector.assert_called_once_with({ "a": "frame1", "b": "frame2", "c": "frame2" })
def test_debug_on_stack_no_stack(): """ In certain rare situations the runner could send an empty stack. ToDo: Look into this. """ editor = mock.MagicMock() view = mock.MagicMock() dm = DebugMode(editor, view) dm.debug_on_stack([]) assert view.update_debug_inspector.call_count == 0