[Python-checkins] CVS: python/dist/src/Lib/test test_profilehooks.py,1.5,1.6

Fred L. Drake fdrake@users.sourceforge.net
2001年10月04日 07:49:48 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv28778
Modified Files:
	test_profilehooks.py 
Log Message:
Updated to reflect the rationalized profiler event reporting.
Index: test_profilehooks.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_profilehooks.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** test_profilehooks.py	2001年10月03日 21:15:32	1.5
--- test_profilehooks.py	2001年10月04日 14:49:46	1.6
***************
*** 38,42 ****
 
 class ProfileSimulator(HookWatcher):
! def __init__(self):
 self.stack = []
 HookWatcher.__init__(self)
--- 38,43 ----
 
 class ProfileSimulator(HookWatcher):
! def __init__(self, testcase):
! self.testcase = testcase
 self.stack = []
 HookWatcher.__init__(self)
***************
*** 55,65 ****
 
 def trace_exception(self, frame):
! if len(self.stack) >= 2 and frame is self.stack[-2]:
! self.add_event('propogate-from', self.stack[-1])
! self.stack.pop()
! else:
! # Either an exception was raised in Python or a C function
! # raised an exception; this does not represent propogation.
! self.add_event('ignore', frame)
 
 dispatch = {
--- 56,61 ----
 
 def trace_exception(self, frame):
! self.testcase.fail(
! "the profiler should never receive exception events")
 
 dispatch = {
***************
*** 95,100 ****
 f_ident = ident(f)
 self.check_events(f, [(1, 'call', f_ident),
! (1, 'exception', f_ident),
! (0, 'exception', protect_ident),
 ])
 
--- 91,95 ----
 f_ident = ident(f)
 self.check_events(f, [(1, 'call', f_ident),
! (1, 'return', f_ident),
 ])
 
***************
*** 105,109 ****
 f_ident = ident(f)
 self.check_events(f, [(1, 'call', f_ident),
- (1, 'exception', f_ident),
 (1, 'return', f_ident),
 ])
--- 100,103 ----
***************
*** 115,119 ****
 f_ident = ident(f)
 self.check_events(f, [(1, 'call', f_ident),
- (1, 'exception', f_ident),
 (1, 'return', f_ident),
 ])
--- 109,112 ----
***************
*** 124,132 ****
 f_ident = ident(f)
 self.check_events(f, [(1, 'call', f_ident),
- (1, 'exception', f_ident),
 # This isn't what I expected:
! (0, 'exception', protect_ident),
 # I expected this again:
! # (1, 'exception', f_ident),
 ])
 
--- 117,124 ----
 f_ident = ident(f)
 self.check_events(f, [(1, 'call', f_ident),
 # This isn't what I expected:
! # (0, 'exception', protect_ident),
 # I expected this again:
! (1, 'return', f_ident),
 ])
 
***************
*** 144,152 ****
 self.check_events(g, [(1, 'call', g_ident),
 (2, 'call', f_ident),
! (2, 'exception', f_ident),
! (1, 'exception', g_ident),
 (3, 'call', f_ident),
! (3, 'exception', f_ident),
! (1, 'exception', g_ident),
 (1, 'return', g_ident),
 ])
--- 136,142 ----
 self.check_events(g, [(1, 'call', g_ident),
 (2, 'call', f_ident),
! (2, 'return', f_ident),
 (3, 'call', f_ident),
! (3, 'return', f_ident),
 (1, 'return', g_ident),
 ])
***************
*** 162,169 ****
 self.check_events(g, [(1, 'call', g_ident),
 (2, 'call', f_ident),
! (2, 'exception', f_ident),
! (1, 'exception', g_ident),
 (1, 'falling through', g_ident),
! (0, 'exception', protect_ident),
 ])
 
--- 152,158 ----
 self.check_events(g, [(1, 'call', g_ident),
 (2, 'call', f_ident),
! (2, 'return', f_ident),
 (1, 'falling through', g_ident),
! (1, 'return', g_ident),
 ])
 
***************
*** 174,180 ****
 f_ident = ident(f)
 self.check_events(f, [(1, 'call', f_ident),
! (1, 'exception', f_ident),
! (1, 'exception', f_ident),
! (0, 'exception', protect_ident)
 ])
 
--- 163,167 ----
 f_ident = ident(f)
 self.check_events(f, [(1, 'call', f_ident),
! (1, 'return', f_ident),
 ])
 
***************
*** 185,190 ****
 f_ident = ident(f)
 self.check_events(f, [(1, 'call', f_ident),
! (1, 'exception', f_ident),
! (0, 'exception', protect_ident)
 ])
 
--- 172,176 ----
 f_ident = ident(f)
 self.check_events(f, [(1, 'call', f_ident),
! (1, 'return', f_ident),
 ])
 
***************
*** 194,199 ****
 f_ident = ident(f)
 self.check_events(f, [(1, 'call', f_ident),
! (1, 'exception', f_ident),
! (0, 'exception', protect_ident)
 ])
 
--- 180,184 ----
 f_ident = ident(f)
 self.check_events(f, [(1, 'call', f_ident),
! (1, 'return', f_ident),
 ])
 
***************
*** 219,228 ****
 (4, 'call', g_ident),
 (5, 'call', f_ident),
! (5, 'exception', f_ident),
! (4, 'exception', g_ident),
! (3, 'exception', h_ident),
! (2, 'exception', i_ident),
! (1, 'exception', j_ident),
! (0, 'exception', protect_ident),
 ])
 
--- 204,212 ----
 (4, 'call', g_ident),
 (5, 'call', f_ident),
! (5, 'return', f_ident),
! (4, 'return', g_ident),
! (3, 'return', h_ident),
! (2, 'return', i_ident),
! (1, 'return', j_ident),
 ])
 
***************
*** 267,271 ****
 # once more to hit the raise:
 (2, 'call', f_ident),
! (2, 'exception', f_ident),
 (1, 'return', g_ident),
 ])
--- 251,255 ----
 # once more to hit the raise:
 (2, 'call', f_ident),
! (2, 'return', f_ident),
 (1, 'return', g_ident),
 ])
***************
*** 274,278 ****
 class ProfileSimulatorTestCase(TestCaseBase):
 def new_watcher(self):
! return ProfileSimulator()
 
 def test_simple(self):
--- 258,262 ----
 class ProfileSimulatorTestCase(TestCaseBase):
 def new_watcher(self):
! return ProfileSimulator(self)
 
 def test_simple(self):
***************
*** 289,294 ****
 f_ident = ident(f)
 self.check_events(f, [(1, 'call', f_ident),
! (1, 'ignore', f_ident),
! (1, 'propogate-from', f_ident),
 ])
 
--- 273,277 ----
 f_ident = ident(f)
 self.check_events(f, [(1, 'call', f_ident),
! (1, 'return', f_ident),
 ])
 
***************
*** 299,303 ****
 f_ident = ident(f)
 self.check_events(f, [(1, 'call', f_ident),
- (1, 'ignore', f_ident),
 (1, 'return', f_ident),
 ])
--- 282,285 ----
***************
*** 324,333 ****
 (4, 'call', g_ident),
 (5, 'call', f_ident),
! (5, 'ignore', f_ident),
! (5, 'propogate-from', f_ident),
! (4, 'propogate-from', g_ident),
! (3, 'propogate-from', h_ident),
! (2, 'propogate-from', i_ident),
! (1, 'propogate-from', j_ident),
 ])
 
--- 306,314 ----
 (4, 'call', g_ident),
 (5, 'call', f_ident),
! (5, 'return', f_ident),
! (4, 'return', g_ident),
! (3, 'return', h_ident),
! (2, 'return', i_ident),
! (1, 'return', j_ident),
 ])
 

AltStyle によって変換されたページ (->オリジナル) /