當前位置: 首頁>>代碼示例>>Python>>正文


Python interface.implementer方法代碼示例

本文整理匯總了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) 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:20,代碼來源:test_verify.py

示例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) 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:19,代碼來源:test_verify.py

示例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) 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:20,代碼來源:test_verify.py

示例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) 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:20,代碼來源:test_verify.py

示例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) 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:20,代碼來源:test_verify.py

示例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) 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:18,代碼來源:test_verify.py

示例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) 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:18,代碼來源:test_verify.py

示例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) 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:20,代碼來源:test_verify.py

示例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) 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:18,代碼來源:test_verify.py

示例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) 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:18,代碼來源:test_verify.py

示例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) 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:18,代碼來源:test_verify.py

示例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) 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:18,代碼來源:test_verify.py

示例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) 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:18,代碼來源:test_verify.py

示例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) 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:20,代碼來源:test_verify.py

示例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) 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:20,代碼來源:test_verify.py


注:本文中的zope.interface.implementer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。