RAPTOR v18.4: Исправлена отчетность, активированы выходные
This commit is contained in:
26
invest-python-master/tests/caches/test_ttl_cache.py
Normal file
26
invest-python-master/tests/caches/test_ttl_cache.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from datetime import timedelta
|
||||
|
||||
from cachetools import TTLCache as StandardTTLCache
|
||||
from pytest_freezegun import freeze_time
|
||||
|
||||
from t_tech.invest.caching.overrides import TTLCache as OverridenTTLCache
|
||||
|
||||
|
||||
class TestTTLCache:
|
||||
def _assert_ttl_cache(self, ttl_cache_class, expires):
|
||||
with freeze_time() as frozen_datetime:
|
||||
ttl = ttl_cache_class(
|
||||
maxsize=10,
|
||||
ttl=1,
|
||||
)
|
||||
ttl.update({"1": 1})
|
||||
|
||||
assert ttl.keys()
|
||||
frozen_datetime.tick(timedelta(seconds=10000))
|
||||
assert not ttl.keys() == expires
|
||||
|
||||
def test_overriden_cache(self):
|
||||
self._assert_ttl_cache(OverridenTTLCache, expires=True)
|
||||
|
||||
def test_standard_cache(self):
|
||||
self._assert_ttl_cache(StandardTTLCache, expires=False)
|
||||
Reference in New Issue
Block a user