Example #1
0
    def test_fastcall_dict(self):
        # Test _PyObject_FastCallDict()

        for func, args, expected in self.CALLS_POSARGS:
            with self.subTest(func=func, args=args):
                # kwargs=NULL
                result = _testcapi.pyobject_fastcalldict(func, args, None)
                self.check_result(result, expected)

                # kwargs={}
                result = _testcapi.pyobject_fastcalldict(func, args, {})
                self.check_result(result, expected)

                if not args:
                    # args=NULL, nargs=0, kwargs=NULL
                    result = _testcapi.pyobject_fastcalldict(func, None, None)
                    self.check_result(result, expected)

                    # args=NULL, nargs=0, kwargs={}
                    result = _testcapi.pyobject_fastcalldict(func, None, {})
                    self.check_result(result, expected)

        for func, args, kwargs, expected in self.CALLS_KWARGS:
            with self.subTest(func=func, args=args, kwargs=kwargs):
                result = _testcapi.pyobject_fastcalldict(func, args, kwargs)
                self.check_result(result, expected)
Example #2
0
 def test_fastcall_dict(self):
     for func, args, expected in self.CALLS_POSARGS:
         with self.subTest(func=func, args=args):
             result = _testcapi.pyobject_fastcalldict(func, args, None)
             self.check_result(result, expected)
             result = _testcapi.pyobject_fastcalldict(func, args, {})
             self.check_result(result, expected)
             if not args:
                 result = _testcapi.pyobject_fastcalldict(func, None, None)
                 self.check_result(result, expected)
                 result = _testcapi.pyobject_fastcalldict(func, None, {})
                 self.check_result(result, expected)
     for func, args, kwargs, expected in self.CALLS_KWARGS:
         with self.subTest(func=func, args=args, kwargs=kwargs):
             result = _testcapi.pyobject_fastcalldict(func, args, kwargs)
             self.check_result(result, expected)