本文整理汇总了Python中pydenji.ducktypes.signature.is_signature_compatible函数的典型用法代码示例。如果您正苦于以下问题:Python is_signature_compatible函数的具体用法?Python is_signature_compatible怎么用?Python is_signature_compatible使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_signature_compatible函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _verify_special_methods
def _verify_special_methods(self, someobj):
someobj_special_methods = self._fetch_special_methods(someobj)
our_special_methods = self._fetch_special_methods(self.reference_obj)
missing = set(our_special_methods).difference(set(someobj_special_methods))
if missing:
# someobj is lacking some method we need
raise SignatureVerificationError, "%s lacks methods: %s" % (someobj, missing)
for name, method in our_special_methods.items():
if not is_signature_compatible(method, someobj_special_methods[name]):
raise SignatureVerificationError, "%s signature for %s is incompatible" % (someobj, method)
示例2: test_two_fixed_args_incompatible_three_args_varargs
def test_two_fixed_args_incompatible_three_args_varargs(self):
self.assertEquals(False, is_signature_compatible(two_arg_callable1, three_args_varargs_callable))
示例3: test_kwargs_compatible_with_optarg_kwargs
def test_kwargs_compatible_with_optarg_kwargs(self):
self.assertEquals(True, is_signature_compatible(all_kwargs_callable, optarg_kwargs_callable))
示例4: test_arg_optarg_kwargs_callable_compatible_with_mixed_everything_callable
def test_arg_optarg_kwargs_callable_compatible_with_mixed_everything_callable(self):
self.assertEquals(True, is_signature_compatible(arg_optarg_kwargs_callable, mixed_everything_callable))
示例5: test_vararg_kwargs_incompatible_with_everything_but_itself
def test_vararg_kwargs_incompatible_with_everything_but_itself(self):
everything_but_varargs_kwargs_callable = filter(lambda x: x.func_name != "varargs_kwargs_callable", everything)
for func in everything_but_varargs_kwargs_callable:
self.assertEquals(False, is_signature_compatible(varargs_kwargs_callable, func), "%s is compatible!" % func.func_name)
示例6: test_unboundmethod_signature_is_not_compatible_with_instancemeth
def test_unboundmethod_signature_is_not_compatible_with_instancemeth(self):
self.assertFalse(is_signature_compatible(DifferentMethods.instancemeth, self.obj.instancemeth))
示例7: test_attrfunc_signature_is_compatible_with_instancemeth
def test_attrfunc_signature_is_compatible_with_instancemeth(self):
self.assertTrue(is_signature_compatible(self.obj.attrfunc, self.obj.instancemeth))
示例8: test_attrfunc_signature_is_not_compatible_with_class_unbound_method
def test_attrfunc_signature_is_not_compatible_with_class_unbound_method(self):
self.assertFalse(is_signature_compatible(self.obj.attrfunc, DifferentMethods.instancemeth))
示例9: test_static_signature_is_compatible_with_attrfunc
def test_static_signature_is_compatible_with_attrfunc(self):
self.assertTrue(is_signature_compatible(self.obj.staticmeth, self.obj.attrfunc))
示例10: test_static_signature_is_compatible_with_obj_instance_method
def test_static_signature_is_compatible_with_obj_instance_method(self):
self.assertTrue(is_signature_compatible(self.obj.staticmeth, self.obj.instancemeth))
示例11: test_static_signature_is_compatible_with_obj_class_sig
def test_static_signature_is_compatible_with_obj_class_sig(self):
self.assertTrue(is_signature_compatible(self.obj.staticmeth, self.obj.classmeth))
示例12: test_all_varargs_is_not_compatibile_with_three_args_varargs
def test_all_varargs_is_not_compatibile_with_three_args_varargs(self):
self.assertEquals(False, is_signature_compatible(all_varargs_callable, three_args_varargs_callable))
示例13: test_three_args_varargs_is_compatible_with_three_args_varargs
def test_three_args_varargs_is_compatible_with_three_args_varargs(self):
self.assertEquals(True, is_signature_compatible(three_args_varargs_callable, three_args_varargs_callable))
示例14: test_all_varargs_is_compatibile_with_all_varargs
def test_all_varargs_is_compatibile_with_all_varargs(self):
self.assertEquals(True, is_signature_compatible(all_varargs_callable, all_varargs_callable))
示例15: test_all_varargs_is_not_compatibile_with_empty
def test_all_varargs_is_not_compatibile_with_empty(self):
self.assertEquals(False, is_signature_compatible(all_varargs_callable, empty_callable))