def assert_looks_like ( first , second , msg = None ) : first = _re . sub ( "\s+" , " " , first . strip ( ) ) second = _re . sub ( "\s+" , " " , second . strip ( ) ) if first != second : raise AssertionError ( msg or "%r does not look like %r" % ( first , second ) )
python compare string is similar to another one
Compare two strings if all contiguous whitespace is coalesced .
def assert_looks_like(first, second, msg=None):
    """ Compare two strings if all contiguous whitespace is coalesced. """
    first = _re.sub("\s+", " ", first.strip())
    second = _re.sub("\s+", " ", second.strip())
    if first != second:
        raise AssertionError(msg or "%r does not look like %r" % (first, second))