当前位置: 首页>>代码示例>>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;未经允许,请勿转载。