capybara/result.py
def failure_message(self):
        """ str: A message describing the query failure. """

        message = failure_message(self.query.description, self.query.options)

        if len(self) > 0:
            message += ", found {count} {matches}: {results}".format(
                count=len(self),
                matches=declension("match", "matches", len(self)),
                results=", ".join([desc(node.text) for node in self]))
        else:
            message += " but there were no matches"

        if self._rest:
            elements = ", ".join([desc(element.text) for element in self._rest])
            message += (". Also found {}, which matched the selector"
                        " but not all filters.".format(elements))

        return message
def failure_message(self):
        """ str: A message describing the query failure. """

        message = failure_message(self.query.description, self.query.options)

        if len(self) > 0:
            message += ", found {count} {matches}: {results}".format(
                count=len(self),
                matches=declension("match", "matches", len(self)),
                results=", ".join([desc(node.text) for node in self]))
        else:
            message += " but there were no matches"

        if self._rest:
            elements = ", ".join([desc(element.text) for element in self._rest])
            message += (". Also found {}, which matched the selector"
                        " but not all filters.".format(elements))

        return message
str: A message describing the query failure.