예제 #1
0
    def test_interp2app_unwrap_spec_r_uint(self):
        space = self.space
        w = space.wrap

        def g3_ll(space, n):
            return space.wrap(n * 3)

        app_g3_ll = gateway.interp2app_temp(g3_ll, unwrap_spec=[gateway.ObjSpace, gateway.r_uint])
        w_app_g3_ll = space.wrap(app_g3_ll)
        w_big = w(gateway.r_uint(sys.maxint + 100))
        assert space.eq_w(space.call_function(w_app_g3_ll, w_big), w(gateway.r_uint((sys.maxint + 100) * 3)))
        space.raises_w(space.w_OverflowError, space.call_function, w_app_g3_ll, w(10L ** 100))
        space.raises_w(space.w_ValueError, space.call_function, w_app_g3_ll, w(-1))
예제 #2
0
    def test_interp2app_unwrap_spec_r_uint(self):
        space = self.space
        w = space.wrap

        def g3_ll(space, n):
            return space.wrap(n * 3)

        app_g3_ll = gateway.interp2app_temp(
            g3_ll, unwrap_spec=[gateway.ObjSpace, gateway.r_uint])
        w_app_g3_ll = space.wrap(app_g3_ll)
        w_big = w(gateway.r_uint(sys.maxint + 100))
        assert space.eq_w(space.call_function(w_app_g3_ll, w_big),
                          w(gateway.r_uint((sys.maxint + 100) * 3)))
        space.raises_w(space.w_OverflowError, space.call_function, w_app_g3_ll,
                       w(10L**100))
        space.raises_w(space.w_ValueError, space.call_function, w_app_g3_ll,
                       w(-1))