mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Issue #29203: functools.lru_cache() now respects PEP 468
This commit is contained in:
parent
04316c4cc8
commit
4ee39141e8
4 changed files with 35 additions and 35 deletions
|
@ -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"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue