示例#1
0
    def verify_storage(storage):
        """

        :param storage:
        :return:
        """
        if not IProtocolStogareInterface.providedBy(storage):

            raise DoesNotImplement(
                'A storage {} does not implement IProtocolStogareInterface'.
                format(storage))

        else:
            return storage
示例#2
0
    def verify_storage(storage):

        """

        :param storage:
        :return:
        """
        if not IProtocolStogareInterface.providedBy(storage):

            raise DoesNotImplement(
                'A storage {} does not implement IProtocolStogareInterface'.format(storage)
            )

        else:
            return storage
示例#3
0
    def test_verify_storage(self):

        ps = ProtocolStorage()

        class FakeStorage(object):
            pass

        self.assertTrue(IProtocolStogareInterface.providedBy(ps))
        self.assertTrue(verifyObject(IProtocolStogareInterface, ps))

        with self.assertRaises(DoesNotImplement):

            verifyObject(IProtocolStogareInterface, {})

        with self.assertRaises(DoesNotImplement):

            verifyObject(IProtocolStogareInterface, object)

        with self.assertRaises(DoesNotImplement):
            verifyObject(IProtocolStogareInterface, FakeStorage())
示例#4
0
    def test_verify_storage(self):

        ps = ProtocolStorage()

        class FakeStorage(object):
            pass

        self.assertTrue(IProtocolStogareInterface.providedBy(ps))
        self.assertTrue(verifyObject(IProtocolStogareInterface, ps))

        with self.assertRaises(DoesNotImplement):

            verifyObject(IProtocolStogareInterface, {})

        with self.assertRaises(DoesNotImplement):

            verifyObject(IProtocolStogareInterface, object)

        with self.assertRaises(DoesNotImplement):
            verifyObject(IProtocolStogareInterface, FakeStorage())