capybara/helpers.py
def failure_message(description, options):
    """
    Returns a expectation failure message for the given query description.

    Args:
        description (str): A description of the failed query.
        options (Dict[str, Any]): The query options.

    Returns:
        str: A message describing the failure.
    """

    message = "expected to find {}".format(description)

    if options["count"] is not None:
        message += " {count} {times}".format(
            count=options["count"],
            times=declension("time", "times", options["count"]))
    elif options["between"] is not None:
        between = options["between"]
        if between:
            first, last = between[0], between[-1]
        else:
            first, last = None, None

        message += " between {first} and {last} times".format(
            first=first,
            last=last)
    elif options["maximum"] is not None:
        message += " at most {maximum} {times}".format(
            maximum=options["maximum"],
            times=declension("time", "times", options["maximum"]))
    elif options["minimum"] is not None:
        message += " at least {minimum} {times}".format(
            minimum=options["minimum"],
            times=declension("time", "times", options["minimum"]))

    return message
def failure_message(description, options):
    message = "expected to find {}".format(description)

    if options["count"] is not None:
        message += " {count} {times}".format(
            count=options["count"],
            times=declension("time", "times", options["count"]))
    elif options["between"] is not None:
        between = options["between"]
        if between:
            first, last = between[0], between[-1]
        else:
            first, last = None, None

        message += " between {first} and {last} times".format(
            first=first,
            last=last)
    elif options["maximum"] is not None:
        message += " at most {maximum} {times}".format(
            maximum=options["maximum"],
            times=declension("time", "times", options["maximum"]))
    elif options["minimum"] is not None:
        message += " at least {minimum} {times}".format(
            minimum=options["minimum"],
            times=declension("time", "times", options["minimum"]))

    return message
def failure_message ( description , options ) : message = "expected to find {}" . format ( description ) if options [ "count" ] is not None : message += " {count} {times}" . format ( count = options [ "count" ] , times = declension ( "time" , "times" , options [ "count" ] ) ) elif options [ "between" ] is not None : between = options [ "between" ] if between : first , last = between [ 0 ] , between [ - 1 ] else : first , last = None , None message += " between {first} and {last} times" . format ( first = first , last = last ) elif options [ "maximum" ] is not None : message += " at most {maximum} {times}" . format ( maximum = options [ "maximum" ] , times = declension ( "time" , "times" , options [ "maximum" ] ) ) elif options [ "minimum" ] is not None : message += " at least {minimum} {times}" . format ( minimum = options [ "minimum" ] , times = declension ( "time" , "times" , options [ "minimum" ] ) ) return message
Returns a expectation failure message for the given query description.

    Args:
        description (str): A description of the failed query.
        options (Dict[str, Any]): The query options.

    Returns:
        str: A message describing the failure.
Returns a expectation failure message for the given query description .