def assert_attr_equal(attr, left, right, obj='<STR_LIT>'):
__tracebackhide__ = True<EOL>left_attr = getattr(left, attr)<EOL>right_attr = getattr(right, attr)<EOL>if left_attr is right_attr:<EOL><INDENT>return True<EOL><DEDENT>elif (is_number(left_attr) and np.isnan(left_attr) and<EOL>is_number(right_attr) and np.isnan(right_attr)):<EOL><INDENT>return True<EOL><DEDENT>try:<EOL><INDENT>result = left_attr == right_attr<EOL><DEDENT>except TypeError:<EOL><INDENT>result = False<EOL><DEDENT>if not isinstance(result, bool):<EOL><INDENT>result = result.all()<EOL><DEDENT>if result:<EOL><INDENT>return True<EOL><DEDENT>else:<EOL><INDENT>msg = '<STR_LIT>'.format(attr=attr)<EOL>raise_assert_detail(obj, msg, left_attr, right_attr)<EOL><DEDENT>
checks attributes are equal. Both objects must have attribute.

    Parameters
    ----------
    attr : str
        Attribute name being compared.
    left : object
    right : object
    obj : str, default 'Attributes'
        Specify object name being compared, internally used to show appropriate
        assertion message