Exemple #1
0
    def _test_function_signature(self,
                                 func,
                                 expected_signature,
                                 has_varargs=False,
                                 has_varkwargs=False):
        sig = FunctionSignature(func)

        self.assertEqual(len(expected_signature), len(sig._args))
        self.assertEqual(len(expected_signature), sig.get_num_args())
        for expected_arg, arg in zip(expected_signature, sig._args):
            if isinstance(expected_arg, tuple):
                expected_arg = ExpectedArg(*expected_arg)
            self.assertEqual(expected_arg.name, arg.name)
            self.assertEqual(expected_arg.has_default, arg.has_default())
            if expected_arg.has_default:
                self.assertEqual(expected_arg.default, arg.default)
        self.assertEqual(sig.has_variable_kwargs(), has_varkwargs)
        self.assertEqual(sig.has_variable_args(), has_varargs)
    def _test_function_signature(self,
        func,
        expected_signature,
        has_varargs=False,
        has_varkwargs=False
        ):
        sig = FunctionSignature(func)

        self.assertEquals(len(expected_signature), len(sig._args))
        self.assertEquals(len(expected_signature), sig.get_num_args())
        for expected_arg, arg in zip(expected_signature, sig._args):
            if isinstance(expected_arg, tuple):
                expected_arg = ExpectedArg(*expected_arg)
            self.assertEquals(expected_arg.name,
                              arg.name)
            self.assertEquals(expected_arg.has_default,
                              arg.has_default())
            if expected_arg.has_default:
                self.assertEquals(expected_arg.default, arg.default)
        self.assertEquals(sig.has_variable_kwargs(), has_varkwargs)
        self.assertEquals(sig.has_variable_args(), has_varargs)
Exemple #3
0
 def test__binary_global_function(self):
     sig = FunctionSignature(time.time)
     self.assertEqual(sig._args, [])
     self.assertTrue(sig.has_variable_args())
     self.assertTrue(sig.has_variable_kwargs())
 def test__binary_global_function(self):
     sig = FunctionSignature(time.time)
     self.assertEquals(sig._args, [])
     self.assertTrue(sig.has_variable_args())
     self.assertTrue(sig.has_variable_kwargs())