diff options
Diffstat (limited to 'tests/test_deprecated.py')
-rw-r--r-- | tests/test_deprecated.py | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/tests/test_deprecated.py b/tests/test_deprecated.py new file mode 100644 index 0000000..6510c82 --- /dev/null +++ b/tests/test_deprecated.py @@ -0,0 +1,67 @@ +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) |