예제 #1
0
async def test_cached_call_func(store: Storage):
    def func(a):
        return a + 1

    key = store.make_func_key(func, 4)
    assert await store.get_cache(key) is None
    assert await store.cached_call(func, 4) == 5
    assert await store.get_cache(key) == b'5'
    assert await store.cached_call(func, 4) == 5
예제 #2
0
async def test_cached_call_coro(store: Storage):
    async def coro(a):
        return a + 1

    key = store.make_func_key(coro, 4)
    assert await store.get_cache(key) is None
    assert await store.cached_call(coro, 4) == 5
    assert await store.get_cache(key) == b'5'
    assert await store.cached_call(coro, 4) == 5