Exemple #1
0
    def test_no_decorator(self):
        expected = getargspec(self.controller.index.__func__)
        actual = util.getargspec(self.controller.index.__func__)
        assert expected == actual

        expected = getargspec(self.controller.static_index)
        actual = util.getargspec(self.controller.static_index)
        assert expected == actual
Exemple #2
0
    def test_simple_decorator(self):
        def dec(f):
            return f

        expected = getargspec(self.controller.index.__func__)
        actual = util.getargspec(dec(self.controller.index.__func__))
        assert expected == actual

        expected = getargspec(self.controller.static_index)
        actual = util.getargspec(dec(self.controller.static_index))
        assert expected == actual
Exemple #3
0
    def test_simple_wrapper(self):
        def dec(f):
            @functools.wraps(f)
            def wrapped(*a, **kw):
                return f(*a, **kw)
            return wrapped

        expected = getargspec(self.controller.index.__func__)
        actual = util.getargspec(dec(self.controller.index.__func__))
        assert expected == actual

        expected = getargspec(self.controller.static_index)
        actual = util.getargspec(dec(self.controller.static_index))
        assert expected == actual
Exemple #4
0
    def test_decorator_with_args(self):
        def dec(flag):
            def inner(f):
                @functools.wraps(f)
                def wrapped(*a, **kw):
                    return f(*a, **kw)
                return wrapped
            return inner

        expected = getargspec(self.controller.index.__func__)
        actual = util.getargspec(dec(True)(self.controller.index.__func__))
        assert expected == actual

        expected = getargspec(self.controller.static_index)
        actual = util.getargspec(dec(True)(
            self.controller.static_index))
        assert expected == actual