mirror of
				https://github.com/python/cpython.git
				synced 2025-10-30 21:21:22 +00:00 
			
		
		
		
	Issue an actual PendingDeprecationWarning for the TestCase.fail* methods.
Document the deprecation.
This commit is contained in:
		
							parent
							
								
									41448c58d2
								
							
						
					
					
						commit
						65ff00559a
					
				
					 2 changed files with 37 additions and 8 deletions
				
			
		|  | @ -54,6 +54,7 @@ def testMultiply(self): | |||
| import time | ||||
| import traceback | ||||
| import types | ||||
| import warnings | ||||
| 
 | ||||
| ############################################################################## | ||||
| # Exported classes and functions | ||||
|  | @ -574,15 +575,22 @@ def assertNotAlmostEqual(self, first, second, places=7, msg=None): | |||
|     assert_ = assertTrue | ||||
| 
 | ||||
|     # These fail* assertion method names are pending deprecation and will | ||||
|     # be a deprecation warning in 3.2; http://bugs.python.org/issue2578 | ||||
|     failUnlessEqual = assertEqual | ||||
|     failIfEqual = assertNotEqual | ||||
|     failUnlessAlmostEqual = assertAlmostEqual | ||||
|     failIfAlmostEqual = assertNotAlmostEqual | ||||
|     failUnless = assertTrue | ||||
|     failUnlessRaises = assertRaises | ||||
|     failIf = assertFalse | ||||
|     # be a DeprecationWarning in 3.2; http://bugs.python.org/issue2578 | ||||
|     def __deprecate(original_func): | ||||
|         def deprecated_func(*args, **kwargs): | ||||
|             warnings.warn( | ||||
|                 'Please use {0} instead.'.format(original_func.__name__), | ||||
|                 PendingDeprecationWarning, 2) | ||||
|             return original_func(*args, **kwargs) | ||||
|         return deprecated_func | ||||
| 
 | ||||
|     failUnlessEqual = __deprecate(assertEqual) | ||||
|     failIfEqual = __deprecate(assertNotEqual) | ||||
|     failUnlessAlmostEqual = __deprecate(assertAlmostEqual) | ||||
|     failIfAlmostEqual = __deprecate(assertNotAlmostEqual) | ||||
|     failUnless = __deprecate(assertTrue) | ||||
|     failUnlessRaises = __deprecate(assertRaises) | ||||
|     failIf = __deprecate(assertFalse) | ||||
| 
 | ||||
|     def assertSequenceEqual(self, seq1, seq2, msg=None, seq_type=None): | ||||
|         """An equality assertion for ordered sequences (like lists and tuples). | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Gregory P. Smith
						Gregory P. Smith