from memoize import memoize COUNTER = 0 @memoize def func(*args, **kwargs): global COUNTER COUNTER += 1 return [] def test_memoize_tuple_arg(): old = COUNTER a, b = (), () func(a) func(b) assert COUNTER - old == 1 def test_memoize_list_arg(): "Just check that function still works." a, b = [], [] func(a) func(b) def test_memoize_immutable_kwargs(): "Just check that function still works." old = COUNTER func('a', 'b', a='x', b=()) func('a', 'b', a='x', b=()) assert COUNTER - old == 1 def test_memoize_mutable_kwargs(): "Just check that function still works." func((), (), a={}, b={}, c=()) func((), (), a={}, b={}, c=())