def test_memoized_get():
    d = {':x': 1,
         ':y': (inc, ':x'),
         ':z': (add, ':x', ':y')}
    try:
        import toolz
    except __HOLE__:
        return
    cache = dict()

    getm = toolz.memoize(core.get, cache=cache,
                         key=lambda args, kwargs: args[1:])

    result = getm(d, ':z', get=getm)
    assert result == 3

    assert contains(cache, {(':x',): 1,
                            (':y',): 2,
                            (':z',): 3})
dataset/ETHPy150Open dask/dask/dask/tests/test_core.py/test_memoized_get