def foo(bp, bpmgr): frame = inspect.currentframe() self.assertEqual(True, Mbreakpoint.checkfuncname(bp, frame)) # frame.f_lineno is constantly updated. So adjust for the # line difference between the add_breakpoint and the check. bp3 = bpmgr.add_breakpoint('foo', frame.f_lineno + 1) self.assertEqual(True, Mbreakpoint.checkfuncname(bp3, frame)) self.assertEqual(False, Mbreakpoint.checkfuncname(bp3, frame)) return
def foo(bp, bpmgr): frame = inspect.currentframe() self.assertEqual(True, Mbreakpoint.checkfuncname(bp, frame)) # frame.f_lineno is constantly updated. So adjust for the # line difference between the add_breakpoint and the check. bp3 = bpmgr.add_breakpoint('foo', frame.f_lineno+1) self.assertEqual(True, Mbreakpoint.checkfuncname(bp3, frame)) self.assertEqual(False, Mbreakpoint.checkfuncname(bp3, frame)) return
def test_checkfuncname(self): 'Test Mbreakpoint.checkfuncname()' import inspect frame = inspect.currentframe() bpmgr = Mbreakpoint.BreakpointManager() bp = bpmgr.add_breakpoint('foo', 5) self.assertEqual(False, Mbreakpoint.checkfuncname(bp, frame)) def foo(bp, bpmgr): frame = inspect.currentframe() self.assertEqual(True, Mbreakpoint.checkfuncname(bp, frame)) # frame.f_lineno is constantly updated. So adjust for the # line difference between the add_breakpoint and the check. bp3 = bpmgr.add_breakpoint('foo', frame.f_lineno + 1) self.assertEqual(True, Mbreakpoint.checkfuncname(bp3, frame)) self.assertEqual(False, Mbreakpoint.checkfuncname(bp3, frame)) return bp2 = bpmgr.add_breakpoint(None, None, False, None, 'foo') foo(bp2, bpmgr) return
def test_checkfuncname(self): 'Test Mbreakpoint.checkfuncname()' import inspect frame = inspect.currentframe() bpmgr = Mbreakpoint.BreakpointManager() bp = bpmgr.add_breakpoint('foo', 5) self.assertEqual(False, Mbreakpoint.checkfuncname(bp, frame)) def foo(bp, bpmgr): frame = inspect.currentframe() self.assertEqual(True, Mbreakpoint.checkfuncname(bp, frame)) # frame.f_lineno is constantly updated. So adjust for the # line difference between the add_breakpoint and the check. bp3 = bpmgr.add_breakpoint('foo', frame.f_lineno+1) self.assertEqual(True, Mbreakpoint.checkfuncname(bp3, frame)) self.assertEqual(False, Mbreakpoint.checkfuncname(bp3, frame)) return bp2 = bpmgr.add_breakpoint(None, None, False, None, 'foo') foo(bp2, bpmgr) return