Beispiel #1
0
    def __call__(self, *args, **kwargs):
        """Verify arguments and proxy to _doubles__new__

        :rtype obj:
        :raises VerifyingDoubleArgumentError: If args/kwargs don't match the expected arguments of
            __init__ of the underlying class.
        """
        verify_arguments(self._target, '_doubles__new__', args, kwargs)
        return self._doubles__new__(*args, **kwargs)
Beispiel #2
0
    def __call__(self, *args, **kwargs):
        """Verify arguments and proxy to _doubles__new__

        :rtype obj:
        :raises VerifyingDoubleArgumentError: If args/kwargs don't match the expected arguments of
            __init__ of the underlying class.
        """
        verify_arguments(self._target, '_doubles__new__', args, kwargs)
        return self._doubles__new__(*args, **kwargs)
Beispiel #3
0
    def verify_arguments(self, args=None, kwargs=None):
        """Ensures that the arguments specified match the signature of the real method.

        :raise: ``VerifyingDoubleError`` if the arguments do not match.
        """

        args = self.args if args is None else args
        kwargs = self.kwargs if kwargs is None else kwargs

        try:
            verify_arguments(self._target, self._method_name, args, kwargs)
        except VerifyingBuiltinDoubleArgumentError:
            if doubles.lifecycle.ignore_builtin_verification():
                raise
Beispiel #4
0
    def verify_arguments(self, args=None, kwargs=None):
        """Ensures that the arguments specified match the signature of the real method.

        :raise: ``VerifyingDoubleError`` if the arguments do not match.
        """

        args = self.args if args is None else args
        kwargs = self.kwargs if kwargs is None else kwargs

        try:
            verify_arguments(self._target, self._method_name, args, kwargs)
        except VerifyingBuiltinDoubleArgumentError:
            if doubles.lifecycle.ignore_builtin_verification():
                raise