diff options
author | Raymond Hettinger <python@rcn.com> | 2017-01-08 17:28:20 -0800 |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2017-01-08 17:28:20 -0800 |
commit | 4ee39141e84c511e389080fa3163be043718ea14 (patch) | |
tree | 9b8afc8bc79de080d4bde2a4068f9de6d6f15191 /Lib/test/test_functools.py | |
parent | 04316c4cc8f89e8e87efd055b9626eb9049340c6 (diff) | |
download | cpython-git-4ee39141e84c511e389080fa3163be043718ea14.tar.gz |
Issue #29203: functools.lru_cache() now respects PEP 468
Diffstat (limited to 'Lib/test/test_functools.py')
-rw-r--r-- | Lib/test/test_functools.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py index 3a40861594..27eb57685a 100644 --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -1306,6 +1306,16 @@ class TestLRU: self.assertEqual(fib.cache_info(), self.module._CacheInfo(hits=0, misses=0, maxsize=None, currsize=0)) + def test_kwargs_order(self): + # PEP 468: Preserving Keyword Argument Order + @self.module.lru_cache(maxsize=10) + def f(**kwargs): + return list(kwargs.items()) + self.assertEqual(f(a=1, b=2), [('a', 1), ('b', 2)]) + self.assertEqual(f(b=2, a=1), [('b', 2), ('a', 1)]) + self.assertEqual(f.cache_info(), + self.module._CacheInfo(hits=0, misses=2, maxsize=10, currsize=2)) + def test_lru_cache_decoration(self): def f(zomg: 'zomg_annotation'): """f doc string""" |