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


Python verify.verifyClass方法代碼示例

本文整理匯總了Python中zope.interface.verify.verifyClass方法的典型用法代碼示例。如果您正苦於以下問題:Python verify.verifyClass方法的具體用法?Python verify.verifyClass怎麽用?Python verify.verifyClass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在zope.interface.verify的用法示例。


在下文中一共展示了verify.verifyClass方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_verifyClass

# 需要導入模塊: from zope.interface import verify [as 別名]
# 或者: from zope.interface.verify import verifyClass [as 別名]
def test_verifyClass(self):
        from zope.interface import Attribute
        from zope.interface import Interface
        from zope.interface.verify import verifyClass
        

        class ICheckMe(Interface):
            attr = Attribute(u'My attr')

            def method():
                pass

        class CheckMe(object):
            __implemented__ = ICheckMe
            attr = 'value'

            def method(self):
                pass

        self.assertTrue(verifyClass(ICheckMe, CheckMe)) 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:22,代碼來源:test_interface.py

示例2: test_verifyClass

# 需要導入模塊: from zope.interface import verify [as 別名]
# 或者: from zope.interface.verify import verifyClass [as 別名]
def test_verifyClass(self):
        from zope.interface import Attribute
        from zope.interface import Interface
        from zope.interface.verify import verifyClass


        class ICheckMe(Interface):
            attr = Attribute(u'My attr')

            def method():
                "A method"

        class CheckMe(object):
            __implemented__ = ICheckMe
            attr = 'value'

            def method(self):
                raise NotImplementedError()

        self.assertTrue(verifyClass(ICheckMe, CheckMe)) 
開發者ID:wistbean,項目名稱:learn_python3_spider,代碼行數:22,代碼來源:test_interface.py

示例3: testMissingAttr_with_Extended_Interface

# 需要導入模塊: from zope.interface import verify [as 別名]
# 或者: from zope.interface.verify import verifyClass [as 別名]
def testMissingAttr_with_Extended_Interface(self):

        class II(Interface):
            def f():
                pass

        class I(II):
            pass

        class C(object):
            implements(I)

        self.assertRaises(BrokenImplementation, verifyClass, I, C)

        C.f=lambda self: None

        verifyClass(I, C) 
開發者ID:kuri65536,項目名稱:python-for-android,代碼行數:19,代碼來源:test_verify.py

示例4: _callFUT

# 需要導入模塊: from zope.interface import verify [as 別名]
# 或者: from zope.interface.verify import verifyClass [as 別名]
def _callFUT(self, iface, klass):
        from zope.interface.verify import verifyClass
        return verifyClass(iface, klass) 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:5,代碼來源:test_verify.py

示例5: test_class_misses_attribute_for_attribute

# 需要導入模塊: from zope.interface import verify [as 別名]
# 或者: from zope.interface.verify import verifyClass [as 別名]
def test_class_misses_attribute_for_attribute(self):
        # This check *passes* for verifyClass
        from zope.interface import Attribute
        from zope.interface import Interface
        from zope.interface import implementer

        class ICurrent(Interface):
            attr = Attribute("The foo Attribute")

        @implementer(ICurrent)
        class Current:
            pass

        self._callFUT(ICurrent, Current) 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:16,代碼來源:test_verify.py

示例6: test_implementInterfaceIPushProducer

# 需要導入模塊: from zope.interface import verify [as 別名]
# 或者: from zope.interface.verify import verifyClass [as 別名]
def test_implementInterfaceIPushProducer(self):
        """
        L{FileDescriptor} should implement L{IPushProducer}.
        """
        self.assertTrue(verifyClass(IPushProducer, FileDescriptor)) 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:7,代碼來源:test_filedescriptor.py

示例7: test_reactorInterfaces

# 需要導入模塊: from zope.interface import verify [as 別名]
# 或者: from zope.interface.verify import verifyClass [as 別名]
def test_reactorInterfaces(self):
        """
        Verify that IOCP socket-representing classes implement IReadWriteHandle
        """
        self.assertTrue(verifyClass(IReadWriteHandle, tcp.Connection))
        self.assertTrue(verifyClass(IReadWriteHandle, udp.Port)) 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:8,代碼來源:test_iocp.py

示例8: test_interface

# 需要導入模塊: from zope.interface import verify [as 別名]
# 或者: from zope.interface.verify import verifyClass [as 別名]
def test_interface(self):
        """
        L{server.DNSServerFactory} implements L{IProtocolFactory}.
        """
        self.assertTrue(verifyClass(IProtocolFactory, server.DNSServerFactory)) 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:7,代碼來源:test_server.py

示例9: test_interface

# 需要導入模塊: from zope.interface import verify [as 別名]
# 或者: from zope.interface.verify import verifyClass [as 別名]
def test_interface(self):
        """
        L{ftp.BaseFTPRealm} implements L{IRealm}.
        """
        self.assertTrue(verifyClass(IRealm, ftp.BaseFTPRealm)) 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:7,代碼來源:test_ftp.py

示例10: __init__

# 需要導入模塊: from zope.interface import verify [as 別名]
# 或者: from zope.interface.verify import verifyClass [as 別名]
def __init__(self, resource_type_cls, maintainer):
        assert verifyClass(IResourceType, resource_type_cls), \
            type(resource_type_cls)
        resource_cls_module = get_resource_class_module(resource_type_cls)
        resource_cls_name = get_resource_class_name(resource_type_cls)
        self.resource_type = ResourceType.by_resource_name(
            resource_cls_module, resource_cls_name
        )
        self.maintainer = maintainer 
開發者ID:mazvv,項目名稱:travelcrm,代碼行數:11,代碼來源:resource.py

示例11: test_interface

# 需要導入模塊: from zope.interface import verify [as 別名]
# 或者: from zope.interface.verify import verifyClass [as 別名]
def test_interface(self):
        """
        The type returned by L{trivialInput} implements L{IRichInput}.
        """
        self.assertTrue(verifyClass(IRichInput, trivialInput(Input.apple))) 
開發者ID:ScatterHQ,項目名稱:machinist,代碼行數:7,代碼來源:test_fsm.py

示例12: testVerifyImplementation

# 需要導入模塊: from zope.interface import verify [as 別名]
# 或者: from zope.interface.verify import verifyClass [as 別名]
def testVerifyImplementation(self):
        from zope.interface.verify import verifyClass
        from zope.interface import Interface
        from zope.interface.tests.unitfixtures import Foo
        from zope.interface.tests.unitfixtures import FooInterface
        from zope.interface.tests.unitfixtures import I1
        self.assert_(verifyClass(FooInterface, Foo))
        self.assert_(Interface.providedBy(I1)) 
開發者ID:kuri65536,項目名稱:python-for-android,代碼行數:10,代碼來源:test_interface.py

示例13: testNotImplemented

# 需要導入模塊: from zope.interface import verify [as 別名]
# 或者: from zope.interface.verify import verifyClass [as 別名]
def testNotImplemented(self):

        class C(object): pass

        class I(Interface): pass

        self.assertRaises(DoesNotImplement, verifyClass, I, C)

        classImplements(C, I)

        verifyClass(I, C) 
開發者ID:kuri65536,項目名稱:python-for-android,代碼行數:13,代碼來源:test_verify.py

示例14: testMissingAttr

# 需要導入模塊: from zope.interface import verify [as 別名]
# 或者: from zope.interface.verify import verifyClass [as 別名]
def testMissingAttr(self):

        class I(Interface):
            def f(): pass

        class C(object):
            implements(I)

        self.assertRaises(BrokenImplementation, verifyClass, I, C)

        C.f=lambda self: None

        verifyClass(I, C) 
開發者ID:kuri65536,項目名稱:python-for-android,代碼行數:15,代碼來源:test_verify.py

示例15: testWrongArgs

# 需要導入模塊: from zope.interface import verify [as 別名]
# 或者: from zope.interface.verify import verifyClass [as 別名]
def testWrongArgs(self):

        class I(Interface):
            def f(a): pass

        class C(object):
            def f(self, b): pass

            implements(I)

        # We no longer require names to match.
        #self.assertRaises(BrokenMethodImplementation, verifyClass, I, C)

        C.f=lambda self, a: None

        verifyClass(I, C)

        C.f=lambda self, **kw: None

        self.assertRaises(BrokenMethodImplementation, verifyClass, I, C)

        C.f=lambda self, a, *args: None

        verifyClass(I, C)

        C.f=lambda self, a, *args, **kw: None

        verifyClass(I, C)

        C.f=lambda self, *args: None

        verifyClass(I, C) 
開發者ID:kuri65536,項目名稱:python-for-android,代碼行數:34,代碼來源:test_verify.py


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