コード例 #1
0
ファイル: class_double.py プロジェクト: uber/doubles
    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)
コード例 #2
0
ファイル: class_double.py プロジェクト: uber/doubles
    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)
コード例 #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
コード例 #4
0
ファイル: allowance.py プロジェクト: EasyPost/doubles
    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