Ejemplo n.º 1
0
def declareImplementation(protocol,
                          instancesProvide=(), instancesDoNotProvide=()):

    from traits.adaptation.api import register_provides

    for to_protocol in instancesProvide:
        register_provides(protocol, to_protocol)
Ejemplo n.º 2
0
def declareImplementation(protocol,
                          instancesProvide=(),
                          instancesDoNotProvide=()):

    from traits.adaptation.api import register_provides

    for to_protocol in instancesProvide:
        register_provides(protocol, to_protocol)
    def test_global_register_provides(self):
        from traits.api import Interface

        class IFoo(Interface):
            pass

        obj = {}
        # Global `register_provides`.
        register_provides(dict, IFoo)
        self.assertEqual(obj, adapt(obj, IFoo))
Ejemplo n.º 4
0
    def test_global_register_provides(self):
        from traits.api import Interface

        class IFoo(Interface):
            pass

        obj = {}
        # Global `register_provides`.
        register_provides(dict, IFoo)
        self.assertEqual(obj, adapt(obj, IFoo))