Minor style cleanup
This commit is contained in:
		
							parent
							
								
									b2cb93e06d
								
							
						
					
					
						commit
						3c317dc35e
					
				| 
						 | 
					@ -10,6 +10,7 @@ BuiltinAssertionError = py.builtin.builtins.AssertionError
 | 
				
			||||||
# DebugInterpreter.
 | 
					# DebugInterpreter.
 | 
				
			||||||
_reprcompare = None
 | 
					_reprcompare = None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def format_explanation(explanation):
 | 
					def format_explanation(explanation):
 | 
				
			||||||
    """This formats an explanation
 | 
					    """This formats an explanation
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -114,9 +115,9 @@ def assertrepr_compare(config, op, left, right):
 | 
				
			||||||
        raise
 | 
					        raise
 | 
				
			||||||
    except:
 | 
					    except:
 | 
				
			||||||
        excinfo = py.code.ExceptionInfo()
 | 
					        excinfo = py.code.ExceptionInfo()
 | 
				
			||||||
        explanation = ['(pytest_assertion plugin: representation of '
 | 
					        explanation = [
 | 
				
			||||||
            'details failed. Probably an object has a faulty __repr__.)',
 | 
					            '(pytest_assertion plugin: representation of details failed.  '
 | 
				
			||||||
            str(excinfo)]
 | 
					            'Probably an object has a faulty __repr__.)', str(excinfo)]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if not explanation:
 | 
					    if not explanation:
 | 
				
			||||||
        return None
 | 
					        return None
 | 
				
			||||||
| 
						 | 
					@ -166,11 +167,13 @@ def _compare_eq_sequence(left, right, verbose=False):
 | 
				
			||||||
                            (i, left[i], right[i])]
 | 
					                            (i, left[i], right[i])]
 | 
				
			||||||
            break
 | 
					            break
 | 
				
			||||||
    if len(left) > len(right):
 | 
					    if len(left) > len(right):
 | 
				
			||||||
        explanation += ['Left contains more items, '
 | 
					        explanation += [
 | 
				
			||||||
            'first extra item: %s' % py.io.saferepr(left[len(right)],)]
 | 
					            'Left contains more items, first extra item: %s' %
 | 
				
			||||||
 | 
					            py.io.saferepr(left[len(right)],)]
 | 
				
			||||||
    elif len(left) < len(right):
 | 
					    elif len(left) < len(right):
 | 
				
			||||||
        explanation += ['Right contains more items, '
 | 
					        explanation += [
 | 
				
			||||||
            'first extra item: %s' % py.io.saferepr(right[len(left)],)]
 | 
					            'Right contains more items, first extra item: %s' %
 | 
				
			||||||
 | 
					            py.io.saferepr(right[len(left)],)]
 | 
				
			||||||
    return explanation  # + _diff_text(py.std.pprint.pformat(left),
 | 
					    return explanation  # + _diff_text(py.std.pprint.pformat(left),
 | 
				
			||||||
                        #             py.std.pprint.pformat(right))
 | 
					                        #             py.std.pprint.pformat(right))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue