mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 21:51:50 +00:00 
			
		
		
		
	Merged revisions 81747 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r81747 | michael.foord | 2010-06-05 13:58:39 +0100 (Sat, 05 Jun 2010) | 1 line unittest.TestCase.assertDictEqual and assertMultilineEqual provide better default failure messages in the event of long diffs. ........
This commit is contained in:
		
							parent
							
								
									02ff2100d3
								
							
						
					
					
						commit
						cb11b251a0
					
				
					 2 changed files with 12 additions and 6 deletions
				
			
		|  | @ -2,12 +2,16 @@ | |||
| 
 | ||||
| __unittest = True | ||||
| 
 | ||||
| 
 | ||||
| def safe_repr(obj): | ||||
| _MAX_LENGTH = 80 | ||||
| def safe_repr(obj, short=False): | ||||
|     try: | ||||
|         return repr(obj) | ||||
|         result = repr(obj) | ||||
|     except Exception: | ||||
|         return object.__repr__(obj) | ||||
|         result = object.__repr__(obj) | ||||
|     if not short or len(result) < _MAX_LENGTH: | ||||
|         return result | ||||
|     return result[:_MAX_LENGTH] + ' [truncated]...' | ||||
| 
 | ||||
| 
 | ||||
| def strclass(cls): | ||||
|     return "%s.%s" % (cls.__module__, cls.__name__) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Michael Foord
						Michael Foord