File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -169,19 +169,19 @@ def inc(self, amount=1):
169169 self ._value += amount
170170
171171 @contextmanager
172- def trackBlockRaises (self ):
172+ def countBlockExceptions (self ):
173173 """Decorator to increment if a block raises an exception."""
174174 try :
175175 yield
176176 except Exception , e :
177177 self .inc ()
178178 raise e
179179
180- def trackFunctionRaises (self , f ):
180+ def countFunctionExceptions (self , f ):
181181 """Decorator to increment if a function raises an exception."""
182182 @wraps (f )
183183 def wrapper (* args , ** kwargs ):
184- with self .trackBlockRaises ():
184+ with self .countBlockExceptions ():
185185 return f (* args , ** kwargs )
186186 return wrapper
187187
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ def test_negative_increment_raises(self):
1919 self .assertRaises (ValueError , self .counter .inc , - 1 )
2020
2121 def test_function_decorator (self ):
22- @self .counter .trackFunctionRaises
22+ @self .counter .countFunctionExceptions
2323 def f (r ):
2424 if r :
2525 raise Exception
@@ -34,12 +34,12 @@ def f(r):
3434 self .assertEquals (1 , self .registry .get_sample_value ('c' ))
3535
3636 def test_block_decorator (self ):
37- with self .counter .trackBlockRaises ():
37+ with self .counter .countBlockExceptions ():
3838 pass
3939 self .assertEquals (0 , self .registry .get_sample_value ('c' ))
4040 raised = False
4141 try :
42- with self .counter .trackBlockRaises ():
42+ with self .counter .countBlockExceptions ():
4343 raise Exception
4444 except :
4545 raised = True
You can’t perform that action at this time.
0 commit comments