Files
rk35xx-android14/external/python/cachetools/tests/test_deprecated.py
T
hmz007 36ed224bac Rockchip Anroid14_SDK 20240628-rkr5 (2556df1a)
Signed-off-by: hmz007 <hmz007@gmail.com>
Change-Id: Ib87fdbe7a0be7dc961af3500fe9ea4589a127f9f
2024-10-29 18:12:02 +08:00

68 lines
2.3 KiB
Python

import unittest
import warnings
class DeprecatedTest(unittest.TestCase):
def test_cache(self):
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
from cachetools.cache import Cache
assert len(w) == 1
assert issubclass(w[-1].category, DeprecationWarning)
assert "cachetools.cache" in str(w[-1].message)
def test_fifo(self):
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
from cachetools.fifo import FIFOCache
assert len(w) == 1
assert issubclass(w[-1].category, DeprecationWarning)
assert "cachetools.fifo" in str(w[-1].message)
def test_lfu(self):
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
from cachetools.lfu import LFUCache
assert len(w) == 1
assert issubclass(w[-1].category, DeprecationWarning)
assert "cachetools.lfu" in str(w[-1].message)
def test_lru(self):
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
from cachetools.lru import LRUCache
assert len(w) == 1
assert issubclass(w[-1].category, DeprecationWarning)
assert "cachetools.lru" in str(w[-1].message)
def test_mru(self):
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
from cachetools.mru import MRUCache
assert len(w) == 1
assert issubclass(w[-1].category, DeprecationWarning)
assert "cachetools.mru" in str(w[-1].message)
def test_rr(self):
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
from cachetools.rr import RRCache
assert len(w) == 1
assert issubclass(w[-1].category, DeprecationWarning)
assert "cachetools.rr" in str(w[-1].message)
def test_ttl(self):
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
from cachetools.ttl import TTLCache
assert len(w) == 1
assert issubclass(w[-1].category, DeprecationWarning)
assert "cachetools.ttl" in str(w[-1].message)