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
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
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())