Ensures :attr:`subject` has an attribute *attr*.

def has_attribute(self, attr):
        """
        Ensures :attr:`subject` has an attribute *attr*.
        """
        if not hasattr(self._subject, attr):
            raise self._error_factory(_format("Expected {} to have attribute {}", self._subject, attr))
        return ReferenceInspector(getattr(self._subject, attr))