def verify_arguments()

in doubles/verification.py [0:0]


def verify_arguments(target, method_name, args, kwargs):
    """Verifies that the provided arguments match the signature of the provided method.

    :param Target target: A ``Target`` object containing the object with the method to double.
    :param str method_name: The name of the method to double.
    :param tuple args: The positional arguments the method should be called with.
    :param dict kwargs: The keyword arguments the method should be called with.
    :raise: ``VerifyingDoubleError`` if the provided arguments do not match the signature.
    """

    if method_name == '_doubles__new__':
        return _verify_arguments_of_doubles__new__(target, args, kwargs)

    attr = target.get_attr(method_name)
    method = attr.object

    if attr.kind in ('data', 'attribute', 'toplevel', 'class method', 'static method'):
        try:
            method = method.__get__(None, attr.defining_class)
        except AttributeError:
            method = method.__call__
    elif attr.kind == 'property':
        if args or kwargs:
            raise VerifyingDoubleArgumentError("Properties do not accept arguments.")
        return
    else:
        args = ['self_or_cls'] + list(args)

    _verify_arguments(method, method_name, args, kwargs)