Пример #1
0
    def test__sync_call_with_kwarg_rets(self):
        def async_func(*args, **kwargs):
            cbparam = kwargs.get('callback')
            cbparam(sup=sentinel.val, sup2=sentinel.val2)

        ch = BaseChannel()
        rv = ch._sync_call(async_func, 'callback')
        self.assertEquals(rv, {'sup': sentinel.val, 'sup2': sentinel.val2})
Пример #2
0
    def test__sync_call_no_ret_value(self):
        def async_func(*args, **kwargs):
            cbparam = kwargs.get('callback')
            cbparam()

        ch = BaseChannel()
        rv = ch._sync_call(async_func, 'callback')
        self.assertIsNone(rv)
Пример #3
0
    def test__sync_call_with_mult_rets(self):
        def async_func(*args, **kwargs):
            cbparam = kwargs.get('callback')
            cbparam(sentinel.val, sentinel.val2)

        ch = BaseChannel()
        rv = ch._sync_call(async_func, 'callback')
        self.assertEquals(rv, (sentinel.val, sentinel.val2))
Пример #4
0
    def test__sync_call_with_normal_and_kwarg_rets(self):
        def async_func(*args, **kwargs):
            cbparam = kwargs.get('callback')
            cbparam(sentinel.arg, sup=sentinel.val, sup2=sentinel.val2)

        ch = BaseChannel()
        rv = ch._sync_call(async_func, 'callback')
        self.assertEquals(rv, (sentinel.arg, {'sup':sentinel.val, 'sup2':sentinel.val2}))
Пример #5
0
    def test__sync_call_with_mult_rets(self):
        def async_func(*args, **kwargs):
            cbparam = kwargs.get('callback')
            cbparam(sentinel.val, sentinel.val2)

        ch = BaseChannel()
        rv = ch._sync_call(async_func, 'callback')
        self.assertEquals(rv, (sentinel.val, sentinel.val2))
Пример #6
0
    def test__sync_call_with_kwarg_rets(self):
        def async_func(*args, **kwargs):
            cbparam = kwargs.get("callback")
            cbparam(sup=sentinel.val, sup2=sentinel.val2)

        ch = BaseChannel()
        rv = ch._sync_call(async_func, "callback")
        self.assertEquals(rv, {"sup": sentinel.val, "sup2": sentinel.val2})
Пример #7
0
    def test__sync_call_with_ret_value(self):
        def async_func(*args, **kwargs):
            cbparam = kwargs.get("callback")
            cbparam(sentinel.val)

        ch = BaseChannel()
        rv = ch._sync_call(async_func, "callback")
        self.assertEquals(rv, sentinel.val)
Пример #8
0
    def test__sync_call_no_ret_value(self):
        def async_func(*args, **kwargs):
            cbparam = kwargs.get("callback")
            cbparam()

        ch = BaseChannel()
        rv = ch._sync_call(async_func, "callback")
        self.assertIsNone(rv)