Did I find the right examples for you? yes no

All Samples(8)  |  Call(8)  |  Derive(0)  |  Import(0)

src/p/l/plexnet-HEAD/third_party/generic/pypy/pypy/objspace/std/test/test_multimethod.py   plexnet(Download)
    def test_mmdispatcher(self):
        typeorder = self.typeorder
        add2 = multimethod.MMDispatcher(self.add, [typeorder, typeorder])
        space = 'space'
        w_x = W_IntObject()
        w_s = W_StringObject()
        w_b1 = W_BoolObject()
        w_b2 = W_BoolObject()
        assert add2(space, w_x, w_b1) == 'fine'
        assert add2(space, w_b2, w_x) == 'fine'
        assert add2(space, w_x, w_b1) == 'fine'
        assert add2(space, w_b2, w_x) == 'fine'
        assert add2(space, w_b1, w_b2) == 'fine'
        raises(FailedToImplement, "add2(space, w_b2, w_s)")
        raises(FailedToImplement, "add2(space, w_s, w_b1)")

src/s/y/Sypy-HEAD/objspace/std/test/test_multimethod.py   Sypy(Download)
    def test_mmdispatcher(self):
        typeorder = self.typeorder
        add2 = multimethod.MMDispatcher(self.add, [typeorder, typeorder])
        space = 'space'
        w_x = W_IntObject()
        w_s = W_StringObject()
        w_b1 = W_BoolObject()
        w_b2 = W_BoolObject()
        assert add2(space, w_x, w_b1) == 'fine'
        assert add2(space, w_b2, w_x) == 'fine'
        assert add2(space, w_x, w_b1) == 'fine'
        assert add2(space, w_b2, w_x) == 'fine'
        assert add2(space, w_b1, w_b2) == 'fine'
        raises(FailedToImplement, "add2(space, w_b2, w_s)")
        raises(FailedToImplement, "add2(space, w_s, w_b1)")