diff options
Diffstat (limited to 'Lib/test/test_functools.py')
-rw-r--r-- | Lib/test/test_functools.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py index b89d779..8fee1c6 100644 --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -1251,6 +1251,18 @@ class TestLRU: self.assertEqual(misses, 4) self.assertEqual(currsize, 2) + def test_lru_no_args(self): + @self.module.lru_cache + def square(x): + return x ** 2 + + self.assertEqual(list(map(square, [10, 20, 10])), + [100, 400, 100]) + self.assertEqual(square.cache_info().hits, 1) + self.assertEqual(square.cache_info().misses, 2) + self.assertEqual(square.cache_info().maxsize, 128) + self.assertEqual(square.cache_info().currsize, 2) + def test_lru_bug_35780(self): # C version of the lru_cache was not checking to see if # the user function call has already modified the cache @@ -1582,13 +1594,6 @@ class TestLRU: self.assertEqual(test_func(DoubleEq(2)), # Trigger a re-entrant __eq__ call DoubleEq(2)) # Verify the correct return value - def test_early_detection_of_bad_call(self): - # Issue #22184 - with self.assertRaises(TypeError): - @functools.lru_cache - def f(): - pass - def test_lru_method(self): class X(int): f_cnt = 0 |