@@ -58,7 +58,7 @@ async def test_cache_async(a: int, b: int, expected: int) -> None:
5858 """Test that the cache decorator works correctly for asynchronous functions."""
5959 calls : dict [tuple [int , int ], int ] = defaultdict (int )
6060
61- @cache (storage = lambda : TTLMapAsyncStorage (max_size = 1000 , ttl = timedelta (seconds = 1 )))
61+ @cache (storage = TTLMapAsyncStorage . create_with (max_size = 1000 , ttl = timedelta (seconds = 1 )))
6262 async def func (x : int , y : int ) -> int :
6363 nonlocal calls
6464 calls [(x , y )] += 1
@@ -91,7 +91,7 @@ async def test_cache_dog_piling_async(a: int, b: int, expected: int, tasks_count
9191 """
9292 calls = 0
9393
94- @cache (storage = lambda : TTLMapAsyncStorage (max_size = 1000 , ttl = timedelta (seconds = 1 )))
94+ @cache (storage = TTLMapAsyncStorage . create_with (max_size = 1000 , ttl = timedelta (seconds = 1 )))
9595 async def func (x : int , y : int ) -> int :
9696 await asyncio .sleep (0.1 )
9797 nonlocal calls
@@ -192,7 +192,7 @@ async def test_cache_failing_func_async(a: int, b: int, tasks_count: int) -> Non
192192 """Test that failing functions are not cached in asynchronous context."""
193193 calls = 0
194194
195- @cache (storage = lambda : TTLMapAsyncStorage (max_size = 1000 , ttl = timedelta (seconds = 1 )))
195+ @cache (storage = TTLMapAsyncStorage . create_with (max_size = 1000 , ttl = timedelta (seconds = 1 )))
196196 async def func (x : int , y : int ) -> int :
197197 await asyncio .sleep (0.1 )
198198 nonlocal calls
@@ -227,7 +227,7 @@ def _f() -> None:
227227 ("func" , "storage" ),
228228 [
229229 (_af , TTLMapStorage .create_with (max_size = 1000 , ttl = timedelta (seconds = 1 ))),
230- (_f , lambda : TTLMapAsyncStorage (max_size = 1000 , ttl = timedelta (seconds = 1 ))),
230+ (_f , TTLMapAsyncStorage . create_with (max_size = 1000 , ttl = timedelta (seconds = 1 ))),
231231 ],
232232)
233233def test__decorator__invalid_storage (func : Callable [..., Any ], storage : PStorage | PAsyncStorage ) -> None :
0 commit comments