本文整理汇总了Python中zope.interface.implementer方法的典型用法代码示例。如果您正苦于以下问题:Python interface.implementer方法的具体用法?Python interface.implementer怎么用?Python interface.implementer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zope.interface
的用法示例。
在下文中一共展示了interface.implementer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_class_has_required_method_derived
# 需要导入模块: from zope import interface [as 别名]
# 或者: from zope.interface import implementer [as 别名]
def test_class_has_required_method_derived(self):
from zope.interface import Interface
from zope.interface import implementer
class IBase(Interface):
def method():
pass
class IDerived(IBase):
pass
@implementer(IDerived)
class Current(object):
def method(self):
pass
self._callFUT(IDerived, Current)
示例2: test_method_takes_wrong_arg_names_but_OK
# 需要导入模块: from zope import interface [as 别名]
# 或者: from zope.interface import implementer [as 别名]
def test_method_takes_wrong_arg_names_but_OK(self):
# We no longer require names to match.
from zope.interface import Interface
from zope.interface import implementer
class ICurrent(Interface):
def method(a):
pass
@implementer(ICurrent)
class Current(object):
def method(self, b):
pass
self._callFUT(ICurrent, Current)
示例3: test_method_takes_not_enough_args
# 需要导入模块: from zope import interface [as 别名]
# 或者: from zope.interface import implementer [as 别名]
def test_method_takes_not_enough_args(self):
from zope.interface import Interface
from zope.interface import implementer
from zope.interface.exceptions import BrokenMethodImplementation
class ICurrent(Interface):
def method(a):
pass
@implementer(ICurrent)
class Current(object):
def method(self):
pass
self.assertRaises(BrokenMethodImplementation,
self._callFUT, ICurrent, Current)
示例4: test_method_doesnt_take_required_starargs
# 需要导入模块: from zope import interface [as 别名]
# 或者: from zope.interface import implementer [as 别名]
def test_method_doesnt_take_required_starargs(self):
from zope.interface import Interface
from zope.interface import implementer
from zope.interface.exceptions import BrokenMethodImplementation
class ICurrent(Interface):
def method(*args):
pass
@implementer(ICurrent)
class Current(object):
def method(self):
pass
self.assertRaises(BrokenMethodImplementation,
self._callFUT, ICurrent, Current)
示例5: test_method_doesnt_take_required_only_kwargs
# 需要导入模块: from zope import interface [as 别名]
# 或者: from zope.interface import implementer [as 别名]
def test_method_doesnt_take_required_only_kwargs(self):
from zope.interface import Interface
from zope.interface import implementer
from zope.interface.exceptions import BrokenMethodImplementation
class ICurrent(Interface):
def method(**kw):
pass
@implementer(ICurrent)
class Current(object):
def method(self):
pass
self.assertRaises(BrokenMethodImplementation,
self._callFUT, ICurrent, Current)
示例6: test_method_takes_extra_arg_with_default
# 需要导入模块: from zope import interface [as 别名]
# 或者: from zope.interface import implementer [as 别名]
def test_method_takes_extra_arg_with_default(self):
from zope.interface import Interface
from zope.interface import implementer
class ICurrent(Interface):
def method(a):
pass
@implementer(ICurrent)
class Current(object):
def method(self, a, b=None):
pass
self._callFUT(ICurrent, Current)
示例7: test_method_takes_only_positional_args
# 需要导入模块: from zope import interface [as 别名]
# 或者: from zope.interface import implementer [as 别名]
def test_method_takes_only_positional_args(self):
from zope.interface import Interface
from zope.interface import implementer
class ICurrent(Interface):
def method(a):
pass
@implementer(ICurrent)
class Current(object):
def method(self, *args):
pass
self._callFUT(ICurrent, Current)
示例8: test_method_takes_only_kwargs
# 需要导入模块: from zope import interface [as 别名]
# 或者: from zope.interface import implementer [as 别名]
def test_method_takes_only_kwargs(self):
from zope.interface import Interface
from zope.interface import implementer
from zope.interface.exceptions import BrokenMethodImplementation
class ICurrent(Interface):
def method(a):
pass
@implementer(ICurrent)
class Current(object):
def method(self, **kw):
pass
self.assertRaises(BrokenMethodImplementation,
self._callFUT, ICurrent, Current)
示例9: test_method_takes_extra_starargs
# 需要导入模块: from zope import interface [as 别名]
# 或者: from zope.interface import implementer [as 别名]
def test_method_takes_extra_starargs(self):
from zope.interface import Interface
from zope.interface import implementer
class ICurrent(Interface):
def method(a):
pass
@implementer(ICurrent)
class Current(object):
def method(self, a, *args):
pass
self._callFUT(ICurrent, Current)
示例10: test_method_takes_extra_starargs_and_kwargs
# 需要导入模块: from zope import interface [as 别名]
# 或者: from zope.interface import implementer [as 别名]
def test_method_takes_extra_starargs_and_kwargs(self):
from zope.interface import Interface
from zope.interface import implementer
class ICurrent(Interface):
def method(a):
pass
@implementer(ICurrent)
class Current(object):
def method(self, a, *args, **kw):
pass
self._callFUT(ICurrent, Current)
示例11: test_method_takes_required_positional_and_starargs
# 需要导入模块: from zope import interface [as 别名]
# 或者: from zope.interface import implementer [as 别名]
def test_method_takes_required_positional_and_starargs(self):
from zope.interface import Interface
from zope.interface import implementer
class ICurrent(Interface):
def method(a, *args):
pass
@implementer(ICurrent)
class Current(object):
def method(self, a, *args):
pass
self._callFUT(ICurrent, Current)
示例12: test_method_takes_only_starargs
# 需要导入模块: from zope import interface [as 别名]
# 或者: from zope.interface import implementer [as 别名]
def test_method_takes_only_starargs(self):
from zope.interface import Interface
from zope.interface import implementer
class ICurrent(Interface):
def method(a, *args):
pass
@implementer(ICurrent)
class Current(object):
def method(self, *args):
pass
self._callFUT(ICurrent, Current)
示例13: test_method_takes_required_kwargs
# 需要导入模块: from zope import interface [as 别名]
# 或者: from zope.interface import implementer [as 别名]
def test_method_takes_required_kwargs(self):
from zope.interface import Interface
from zope.interface import implementer
class ICurrent(Interface):
def method(**kwargs):
pass
@implementer(ICurrent)
class Current(object):
def method(self, **kw):
pass
self._callFUT(ICurrent, Current)
示例14: test_method_takes_positional_plus_required_starargs
# 需要导入模块: from zope import interface [as 别名]
# 或者: from zope.interface import implementer [as 别名]
def test_method_takes_positional_plus_required_starargs(self):
from zope.interface import Interface
from zope.interface import implementer
from zope.interface.exceptions import BrokenMethodImplementation
class ICurrent(Interface):
def method(*args):
pass
@implementer(ICurrent)
class Current(object):
def method(self, a, *args):
pass
self.assertRaises(BrokenMethodImplementation,
self._callFUT, ICurrent, Current)
示例15: test_method_doesnt_take_required_kwargs
# 需要导入模块: from zope import interface [as 别名]
# 或者: from zope.interface import implementer [as 别名]
def test_method_doesnt_take_required_kwargs(self):
from zope.interface import Interface
from zope.interface import implementer
from zope.interface.exceptions import BrokenMethodImplementation
class ICurrent(Interface):
def method(**kwargs):
pass
@implementer(ICurrent)
class Current(object):
def method(self, a):
pass
self.assertRaises(BrokenMethodImplementation,
self._callFUT, ICurrent, Current)