Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-cachetools for 
openSUSE:Factory checked in at 2024-10-09 22:03:25
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-cachetools (Old)
 and      /work/SRC/openSUSE:Factory/.python-cachetools.new.19354 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-cachetools"

Wed Oct  9 22:03:25 2024 rev:22 rq:1206442 version:5.5.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-cachetools/python-cachetools.changes      
2024-04-03 17:19:12.958843341 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-cachetools.new.19354/python-cachetools.changes
   2024-10-09 22:03:37.466880548 +0200
@@ -1,0 +2,7 @@
+Sat Sep 28 19:57:53 UTC 2024 - Dirk Müller <dmuel...@suse.com>
+
+- update to 5.5.0:
+  * TTLCache.expire() returns iterable of expired (key, value)
+    pairs.
+
+-------------------------------------------------------------------

Old:
----
  cachetools-5.3.3.tar.gz

New:
----
  cachetools-5.5.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-cachetools.spec ++++++
--- /var/tmp/diff_new_pack.CFgYuz/_old  2024-10-09 22:03:39.754976029 +0200
+++ /var/tmp/diff_new_pack.CFgYuz/_new  2024-10-09 22:03:39.762976363 +0200
@@ -18,7 +18,7 @@
 
 %{?sle15_python_module_pythons}
 Name:           python-cachetools
-Version:        5.3.3
+Version:        5.5.0
 Release:        0
 Summary:        Extensible memoizing collections and decorators
 License:        MIT

++++++ cachetools-5.3.3.tar.gz -> cachetools-5.5.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cachetools-5.3.3/CHANGELOG.rst 
new/cachetools-5.5.0/CHANGELOG.rst
--- old/cachetools-5.3.3/CHANGELOG.rst  2024-02-26 21:28:29.000000000 +0100
+++ new/cachetools-5.5.0/CHANGELOG.rst  2024-08-18 22:19:09.000000000 +0200
@@ -1,3 +1,29 @@
+v5.5.0 (2024-08-18)
+===================
+
+- ``TTLCache.expire()`` returns iterable of expired ``(key, value)``
+  pairs.
+
+- ``TLRUCache.expire()`` returns iterable of expired ``(key, value)``
+  pairs.
+
+- Documentation improvements.
+
+- Update CI environment.
+
+
+v5.4.0 (2024-07-15)
+===================
+
+- Add the ``keys.typedmethodkey`` decorator.
+
+- Deprecate ``MRUCache`` class.
+
+- Deprecate ``@func.mru_cache`` decorator.
+
+- Update CI environment.
+
+
 v5.3.3 (2024-02-26)
 ===================
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cachetools-5.3.3/PKG-INFO 
new/cachetools-5.5.0/PKG-INFO
--- old/cachetools-5.3.3/PKG-INFO       2024-02-26 21:29:16.324993000 +0100
+++ new/cachetools-5.5.0/PKG-INFO       2024-08-18 22:26:29.340427600 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: cachetools
-Version: 5.3.3
+Version: 5.5.0
 Summary: Extensible memoizing collections and decorators
 Home-page: https://github.com/tkem/cachetools/
 Author: Thomas Kemmer
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cachetools-5.3.3/docs/index.rst 
new/cachetools-5.5.0/docs/index.rst
--- old/cachetools-5.3.3/docs/index.rst 2024-02-26 20:48:05.000000000 +0100
+++ new/cachetools-5.5.0/docs/index.rst 2024-08-18 22:19:09.000000000 +0200
@@ -26,6 +26,8 @@
    from unittest import mock
    urllib = mock.MagicMock()
 
+   import time
+
 
 Cache implementations
 =====================
@@ -96,6 +98,12 @@
    This class discards the most recently used items first to make
    space when necessary.
 
+   .. deprecated:: 5.4
+
+   `MRUCache` has been deprecated due to lack of use, to reduce
+   maintenance.  Please choose another cache implementation that suits
+   your needs.
+
 .. autoclass:: RRCache(maxsize, choice=random.choice, getsizeof=None)
    :members: choice, popitem
 
@@ -147,6 +155,8 @@
       items that have expired by the current value returned by
       :attr:`timer`.
 
+      :returns: An iterable of expired `(key, value)` pairs.
+
 .. autoclass:: TLRUCache(maxsize, ttu, timer=time.monotonic, getsizeof=None)
    :members: popitem, timer, ttu
 
@@ -158,18 +168,29 @@
    value of `timer()`.
 
    .. testcode::
-
-      from datetime import datetime, timedelta
-
+   
       def my_ttu(_key, value, now):
-          # assume value.ttl contains the item's time-to-live in hours
-          return now + timedelta(hours=value.ttl)
+          # assume value.ttu contains the item's time-to-use in seconds
+          # note that the _key argument is ignored in this example
+          return now + value.ttu
 
-      cache = TLRUCache(maxsize=10, ttu=my_ttu, timer=datetime.now)
+      cache = TLRUCache(maxsize=10, ttu=my_ttu)
 
    The expression `ttu(key, value, timer())` defines the expiration
    time of a cache item, and must be comparable against later results
-   of `timer()`.
+   of `timer()`.  As with :class:`TTLCache`, a custom `timer` function
+   can be supplied, which does not have to return a numeric value.
+
+   .. testcode::
+
+      from datetime import datetime, timedelta
+
+      def datetime_ttu(_key, value, now):
+          # assume now to be of type datetime.datetime, and
+          # value.hours to contain the item's time-to-use in hours
+          return now + timedelta(hours=value.hours)
+
+      cache = TLRUCache(maxsize=10, ttu=datetime_ttu, timer=datetime.now)
 
    Items that expire because they have exceeded their time-to-use will
    be no longer accessible, and will be removed eventually.  If no
@@ -187,6 +208,8 @@
       items that have expired by the current value returned by
       :attr:`timer`.
 
+      :returns: An iterable of expired `(key, value)` pairs.
+
 
 Extending cache classes
 =======================
@@ -211,6 +234,31 @@
    >>> c['c'] = 3
    Key "a" evicted with value "1"
 
+With :class:`TTLCache` and :class:`TLRUCache`, items may also be
+removed after they expire.  In this case, :meth:`popitem` will *not*
+be called, but :meth:`expire` will be called from the next mutating
+operation and will return an iterable of the expired `(key, value)`
+pairs.  By overrding :meth:`expire`, a subclass will be able to track
+expired items:
+
+.. doctest::
+   :pyversion: >= 3
+
+   >>> class ExpCache(TTLCache):
+   ...     def expire(self, time=None):
+   ...         items = super().expire(time)
+   ...         print(f"Expired items: {items}")
+   ...         return items
+
+   >>> c = ExpCache(maxsize=10, ttl=1.0)
+   >>> c['a'] = 1
+   Expired items: []
+   >>> c['b'] = 2
+   Expired items: []
+   >>> time.sleep(1.5)
+   >>> c['c'] = 3
+   Expired items: [('a', 1), ('b', 2)]
+
 Similar to the standard library's :class:`collections.defaultdict`,
 subclasses of :class:`Cache` may implement a :meth:`__missing__`
 method which is called by :meth:`Cache.__getitem__` if the requested
@@ -416,7 +464,7 @@
 
    .. testcode::
 
-      class CachedPEPs(object):
+      class CachedPEPs:
 
           def __init__(self, cachesize):
               self.cache = LRUCache(maxsize=cachesize)
@@ -444,7 +492,7 @@
 
    .. testcode::
 
-      class CachedReferences(object):
+      class CachedReferences:
 
           def __init__(self, cachesize):
               self.cache = LRUCache(maxsize=cachesize)
@@ -491,7 +539,7 @@
 
 .. autofunction:: methodkey
 
-   This function is equivalent to :func:`hashkey`, but ignores its
+   This function is similar to :func:`hashkey`, but ignores its
    first positional argument, i.e. `self` when used with the
    :func:`cachedmethod` decorator.
 
@@ -502,6 +550,12 @@
    ``typedkey(3)`` and ``typedkey(3.0)`` will return different
    results.
 
+.. autofunction:: typedmethodkey
+
+   This function is similar to :func:`typedkey`, but ignores its
+   first positional argument, i.e. `self` when used with the
+   :func:`cachedmethod` decorator.
+
 These functions can also be helpful when implementing custom key
 functions for handling some non-hashable arguments.  For example,
 calling the following function with a dictionary as its `env` argument
@@ -598,6 +652,11 @@
    saves up to `maxsize` results based on a Most Recently Used (MRU)
    algorithm.
 
+   .. deprecated:: 5.4
+
+   The `mru_cache` decorator has been deprecated due to lack of use.
+   Please choose a decorator based on some other algorithm.
+
 .. decorator:: rr_cache(user_function)
                rr_cache(maxsize=128, choice=random.choice, typed=False)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cachetools-5.3.3/src/cachetools/__init__.py 
new/cachetools-5.5.0/src/cachetools/__init__.py
--- old/cachetools-5.3.3/src/cachetools/__init__.py     2024-02-26 
21:28:29.000000000 +0100
+++ new/cachetools-5.5.0/src/cachetools/__init__.py     2024-08-18 
22:25:15.000000000 +0200
@@ -13,7 +13,7 @@
     "cachedmethod",
 )
 
-__version__ = "5.3.3"
+__version__ = "5.5.0"
 
 import collections
 import collections.abc
@@ -26,7 +26,6 @@
 
 
 class _DefaultSize:
-
     __slots__ = ()
 
     def __getitem__(self, _):
@@ -241,6 +240,10 @@
     """Most Recently Used (MRU) cache implementation."""
 
     def __init__(self, maxsize, getsizeof=None):
+        from warnings import warn
+
+        warn("MRUCache is deprecated", DeprecationWarning, stacklevel=2)
+
         Cache.__init__(self, maxsize, getsizeof)
         self.__order = collections.OrderedDict()
 
@@ -374,7 +377,6 @@
     """LRU Cache implementation with per-item time-to-live (TTL) value."""
 
     class _Link:
-
         __slots__ = ("key", "expires", "next", "prev")
 
         def __init__(self, key=None, expires=None):
@@ -465,19 +467,26 @@
         return self.__ttl
 
     def expire(self, time=None):
-        """Remove expired items from the cache."""
+        """Remove expired items from the cache and return an iterable of the
+        expired `(key, value)` pairs.
+
+        """
         if time is None:
             time = self.timer()
         root = self.__root
         curr = root.next
         links = self.__links
+        expired = []
         cache_delitem = Cache.__delitem__
+        cache_getitem = Cache.__getitem__
         while curr is not root and not (time < curr.expires):
+            expired.append((curr.key, cache_getitem(self, curr.key)))
             cache_delitem(self, curr.key)
             del links[curr.key]
             next = curr.next
             curr.unlink()
             curr = next
+        return expired
 
     def popitem(self):
         """Remove and return the `(key, value)` pair least recently used that
@@ -504,7 +513,6 @@
 
     @functools.total_ordering
     class _Item:
-
         __slots__ = ("key", "expires", "removed")
 
         def __init__(self, key=None, expires=None):
@@ -579,7 +587,10 @@
         return self.__ttu
 
     def expire(self, time=None):
-        """Remove expired items from the cache."""
+        """Remove expired items from the cache and return an iterable of the
+        expired `(key, value)` pairs.
+
+        """
         if time is None:
             time = self.timer()
         items = self.__items
@@ -588,12 +599,16 @@
         if len(order) > len(items) * 2:
             self.__order = order = [item for item in order if not item.removed]
             heapq.heapify(order)
+        expired = []
         cache_delitem = Cache.__delitem__
+        cache_getitem = Cache.__getitem__
         while order and (order[0].removed or not (time < order[0].expires)):
             item = heapq.heappop(order)
             if not item.removed:
+                expired.append((item.key, cache_getitem(self, item.key)))
                 cache_delitem(self, item.key)
                 del items[item.key]
+        return expired
 
     def popitem(self):
         """Remove and return the `(key, value)` pair least recently used that
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cachetools-5.3.3/src/cachetools/func.py 
new/cachetools-5.5.0/src/cachetools/func.py
--- old/cachetools-5.3.3/src/cachetools/func.py 2023-01-22 23:22:12.000000000 
+0100
+++ new/cachetools-5.5.0/src/cachetools/func.py 2024-08-18 22:24:05.000000000 
+0200
@@ -82,6 +82,10 @@
     up to `maxsize` results based on a Most Recently Used (MRU)
     algorithm.
     """
+    from warnings import warn
+
+    warn("@mru_cache is deprecated", DeprecationWarning, stacklevel=2)
+
     if maxsize is None:
         return _cache({}, None, typed)
     elif callable(maxsize):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cachetools-5.3.3/src/cachetools/keys.py 
new/cachetools-5.5.0/src/cachetools/keys.py
--- old/cachetools-5.3.3/src/cachetools/keys.py 2022-05-29 22:40:29.000000000 
+0200
+++ new/cachetools-5.5.0/src/cachetools/keys.py 2024-07-15 20:41:48.000000000 
+0200
@@ -1,6 +1,6 @@
 """Key functions for memoizing decorators."""
 
-__all__ = ("hashkey", "methodkey", "typedkey")
+__all__ = ("hashkey", "methodkey", "typedkey", "typedmethodkey")
 
 
 class _HashedTuple(tuple):
@@ -55,3 +55,8 @@
     key += tuple(type(v) for v in args)
     key += tuple(type(v) for _, v in sorted(kwargs.items()))
     return key
+
+
+def typedmethodkey(self, *args, **kwargs):
+    """Return a typed cache key for use with cached methods."""
+    return typedkey(*args, **kwargs)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cachetools-5.3.3/src/cachetools.egg-info/PKG-INFO 
new/cachetools-5.5.0/src/cachetools.egg-info/PKG-INFO
--- old/cachetools-5.3.3/src/cachetools.egg-info/PKG-INFO       2024-02-26 
21:29:16.000000000 +0100
+++ new/cachetools-5.5.0/src/cachetools.egg-info/PKG-INFO       2024-08-18 
22:26:29.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: cachetools
-Version: 5.3.3
+Version: 5.5.0
 Summary: Extensible memoizing collections and decorators
 Home-page: https://github.com/tkem/cachetools/
 Author: Thomas Kemmer
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cachetools-5.3.3/tests/__init__.py 
new/cachetools-5.5.0/tests/__init__.py
--- old/cachetools-5.3.3/tests/__init__.py      2023-03-17 21:55:31.000000000 
+0100
+++ new/cachetools-5.5.0/tests/__init__.py      2024-08-18 22:19:09.000000000 
+0200
@@ -2,7 +2,6 @@
 
 
 class CacheTestMixin:
-
     Cache = None
 
     def test_defaults(self):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cachetools-5.3.3/tests/test_cache.py 
new/cachetools-5.5.0/tests/test_cache.py
--- old/cachetools-5.3.3/tests/test_cache.py    2023-03-17 21:55:31.000000000 
+0100
+++ new/cachetools-5.5.0/tests/test_cache.py    2024-08-18 22:19:09.000000000 
+0200
@@ -6,5 +6,4 @@
 
 
 class CacheTest(unittest.TestCase, CacheTestMixin):
-
     Cache = cachetools.Cache
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cachetools-5.3.3/tests/test_cachedmethod.py 
new/cachetools-5.5.0/tests/test_cachedmethod.py
--- old/cachetools-5.3.3/tests/test_cachedmethod.py     2024-02-26 
20:48:05.000000000 +0100
+++ new/cachetools-5.5.0/tests/test_cachedmethod.py     2024-07-15 
20:41:48.000000000 +0200
@@ -14,8 +14,8 @@
         self.count += 1
         return count
 
-    @cachedmethod(lambda self: self.cache, key=keys.typedkey)
-    def get_typed(self, value):
+    @cachedmethod(lambda self: self.cache, key=keys.typedmethodkey)
+    def get_typedmethod(self, value):
         count = self.count
         self.count += 1
         return count
@@ -67,16 +67,16 @@
         cached.cache.clear()
         self.assertEqual(cached.get(1), 2)
 
-    def test_typed_dict(self):
+    def test_typedmethod_dict(self):
         cached = Cached(LRUCache(maxsize=2))
 
-        self.assertEqual(cached.get_typed(0), 0)
-        self.assertEqual(cached.get_typed(1), 1)
-        self.assertEqual(cached.get_typed(1), 1)
-        self.assertEqual(cached.get_typed(1.0), 2)
-        self.assertEqual(cached.get_typed(1.0), 2)
-        self.assertEqual(cached.get_typed(0.0), 3)
-        self.assertEqual(cached.get_typed(0), 4)
+        self.assertEqual(cached.get_typedmethod(0), 0)
+        self.assertEqual(cached.get_typedmethod(1), 1)
+        self.assertEqual(cached.get_typedmethod(1), 1)
+        self.assertEqual(cached.get_typedmethod(1.0), 2)
+        self.assertEqual(cached.get_typedmethod(1.0), 2)
+        self.assertEqual(cached.get_typedmethod(0.0), 3)
+        self.assertEqual(cached.get_typedmethod(0), 4)
 
     def test_lru(self):
         cached = Cached(LRUCache(maxsize=2))
@@ -90,16 +90,16 @@
         cached.cache.clear()
         self.assertEqual(cached.get(1), 2)
 
-    def test_typed_lru(self):
+    def test_typedmethod_lru(self):
         cached = Cached(LRUCache(maxsize=2))
 
-        self.assertEqual(cached.get_typed(0), 0)
-        self.assertEqual(cached.get_typed(1), 1)
-        self.assertEqual(cached.get_typed(1), 1)
-        self.assertEqual(cached.get_typed(1.0), 2)
-        self.assertEqual(cached.get_typed(1.0), 2)
-        self.assertEqual(cached.get_typed(0.0), 3)
-        self.assertEqual(cached.get_typed(0), 4)
+        self.assertEqual(cached.get_typedmethod(0), 0)
+        self.assertEqual(cached.get_typedmethod(1), 1)
+        self.assertEqual(cached.get_typedmethod(1), 1)
+        self.assertEqual(cached.get_typedmethod(1.0), 2)
+        self.assertEqual(cached.get_typedmethod(1.0), 2)
+        self.assertEqual(cached.get_typedmethod(0.0), 3)
+        self.assertEqual(cached.get_typedmethod(0), 4)
 
     def test_nospace(self):
         cached = Cached(LRUCache(maxsize=0))
@@ -141,10 +141,10 @@
         self.assertEqual(cached.get(1), 2)
         self.assertEqual(cached.get(1.0), 2)
 
-        ref = cached.get_typed(1)
+        ref = cached.get_typedmethod(1)
         self.assertEqual(ref, 3)
-        self.assertEqual(cached.get_typed(1), 3)
-        self.assertEqual(cached.get_typed(1.0), 4)
+        self.assertEqual(cached.get_typedmethod(1), 3)
+        self.assertEqual(cached.get_typedmethod(1.0), 4)
 
         cached.cache.clear()
         self.assertEqual(cached.get(1), 5)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cachetools-5.3.3/tests/test_fifo.py 
new/cachetools-5.5.0/tests/test_fifo.py
--- old/cachetools-5.3.3/tests/test_fifo.py     2023-03-17 21:55:31.000000000 
+0100
+++ new/cachetools-5.5.0/tests/test_fifo.py     2024-08-18 22:19:09.000000000 
+0200
@@ -6,7 +6,6 @@
 
 
 class LRUCacheTest(unittest.TestCase, CacheTestMixin):
-
     Cache = FIFOCache
 
     def test_fifo(self):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cachetools-5.3.3/tests/test_func.py 
new/cachetools-5.5.0/tests/test_func.py
--- old/cachetools-5.3.3/tests/test_func.py     2023-03-17 21:55:31.000000000 
+0100
+++ new/cachetools-5.5.0/tests/test_func.py     2024-07-15 21:06:23.000000000 
+0200
@@ -100,30 +100,32 @@
 
 
 class FIFODecoratorTest(unittest.TestCase, DecoratorTestMixin):
-
     DECORATOR = staticmethod(cachetools.func.fifo_cache)
 
 
 class LFUDecoratorTest(unittest.TestCase, DecoratorTestMixin):
-
     DECORATOR = staticmethod(cachetools.func.lfu_cache)
 
 
 class LRUDecoratorTest(unittest.TestCase, DecoratorTestMixin):
-
     DECORATOR = staticmethod(cachetools.func.lru_cache)
 
 
 class MRUDecoratorTest(unittest.TestCase, DecoratorTestMixin):
+    def decorator(self, maxsize, **kwargs):
+        import warnings
 
-    DECORATOR = staticmethod(cachetools.func.mru_cache)
+        with warnings.catch_warnings(record=True) as w:
+            warnings.simplefilter("always")
+            d = cachetools.func.mru_cache(maxsize, **kwargs)
+        self.assertNotEqual(len(w), 0)
+        self.assertIs(w[0].category, DeprecationWarning)
+        return d
 
 
 class RRDecoratorTest(unittest.TestCase, DecoratorTestMixin):
-
     DECORATOR = staticmethod(cachetools.func.rr_cache)
 
 
 class TTLDecoratorTest(unittest.TestCase, DecoratorTestMixin):
-
     DECORATOR = staticmethod(cachetools.func.ttl_cache)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cachetools-5.3.3/tests/test_keys.py 
new/cachetools-5.5.0/tests/test_keys.py
--- old/cachetools-5.3.3/tests/test_keys.py     2021-12-19 09:48:13.000000000 
+0100
+++ new/cachetools-5.5.0/tests/test_keys.py     2024-08-18 22:19:09.000000000 
+0200
@@ -21,6 +21,24 @@
         self.assertEqual(key(1, 2, 3), key(1.0, 2.0, 3.0))
         self.assertEqual(hash(key(1, 2, 3)), hash(key(1.0, 2.0, 3.0)))
 
+    def methodkey(self, key=cachetools.keys.methodkey):
+        # similar to hashkey(), but ignores its first positional argument
+        self.assertEqual(key("x"), key("y"))
+        self.assertEqual(hash(key("x")), hash(key("y")))
+        self.assertEqual(key("x", 1, 2, 3), key("y", 1, 2, 3))
+        self.assertEqual(hash(key("x", 1, 2, 3)), hash(key("y", 1, 2, 3)))
+        self.assertEqual(key("x", 1, 2, 3, x=0), key("y", 1, 2, 3, x=0))
+        self.assertEqual(hash(key("x", 1, 2, 3, x=0)), hash(key("y", 1, 2, 3, 
x=0)))
+        self.assertNotEqual(key("x", 1, 2, 3), key("x", 3, 2, 1))
+        self.assertNotEqual(key("x", 1, 2, 3), key("x", 1, 2, 3, x=None))
+        self.assertNotEqual(key("x", 1, 2, 3, x=0), key("x", 1, 2, 3, x=None))
+        self.assertNotEqual(key("x", 1, 2, 3, x=0), key("x", 1, 2, 3, y=0))
+        with self.assertRaises(TypeError):
+            hash("x", key({}))
+        # untyped keys compare equal
+        self.assertEqual(key("x", 1, 2, 3), key("y", 1.0, 2.0, 3.0))
+        self.assertEqual(hash(key("x", 1, 2, 3)), hash(key("y", 1.0, 2.0, 
3.0)))
+
     def test_typedkey(self, key=cachetools.keys.typedkey):
         self.assertEqual(key(), key())
         self.assertEqual(hash(key()), hash(key()))
@@ -37,6 +55,23 @@
         # typed keys compare unequal
         self.assertNotEqual(key(1, 2, 3), key(1.0, 2.0, 3.0))
 
+    def test_typedmethodkey(self, key=cachetools.keys.typedmethodkey):
+        # similar to typedkey(), but ignores its first positional argument
+        self.assertEqual(key("x"), key("y"))
+        self.assertEqual(hash(key("x")), hash(key("y")))
+        self.assertEqual(key("x", 1, 2, 3), key("y", 1, 2, 3))
+        self.assertEqual(hash(key("x", 1, 2, 3)), hash(key("y", 1, 2, 3)))
+        self.assertEqual(key("x", 1, 2, 3, x=0), key("y", 1, 2, 3, x=0))
+        self.assertEqual(hash(key("x", 1, 2, 3, x=0)), hash(key("y", 1, 2, 3, 
x=0)))
+        self.assertNotEqual(key("x", 1, 2, 3), key("x", 3, 2, 1))
+        self.assertNotEqual(key("x", 1, 2, 3), key("x", 1, 2, 3, x=None))
+        self.assertNotEqual(key("x", 1, 2, 3, x=0), key("x", 1, 2, 3, x=None))
+        self.assertNotEqual(key("x", 1, 2, 3, x=0), key("x", 1, 2, 3, y=0))
+        with self.assertRaises(TypeError):
+            hash(key("x", {}))
+        # typed keys compare unequal
+        self.assertNotEqual(key("x", 1, 2, 3), key("x", 1.0, 2.0, 3.0))
+
     def test_addkeys(self, key=cachetools.keys.hashkey):
         self.assertIsInstance(key(), tuple)
         self.assertIsInstance(key(1, 2, 3) + key(4, 5, 6), type(key()))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cachetools-5.3.3/tests/test_lfu.py 
new/cachetools-5.5.0/tests/test_lfu.py
--- old/cachetools-5.3.3/tests/test_lfu.py      2023-03-17 21:55:31.000000000 
+0100
+++ new/cachetools-5.5.0/tests/test_lfu.py      2024-08-18 22:19:09.000000000 
+0200
@@ -6,7 +6,6 @@
 
 
 class LFUCacheTest(unittest.TestCase, CacheTestMixin):
-
     Cache = LFUCache
 
     def test_lfu(self):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cachetools-5.3.3/tests/test_lru.py 
new/cachetools-5.5.0/tests/test_lru.py
--- old/cachetools-5.3.3/tests/test_lru.py      2023-03-17 21:55:31.000000000 
+0100
+++ new/cachetools-5.5.0/tests/test_lru.py      2024-08-18 22:19:09.000000000 
+0200
@@ -6,7 +6,6 @@
 
 
 class LRUCacheTest(unittest.TestCase, CacheTestMixin):
-
     Cache = LRUCache
 
     def test_lru(self):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cachetools-5.3.3/tests/test_mru.py 
new/cachetools-5.5.0/tests/test_mru.py
--- old/cachetools-5.3.3/tests/test_mru.py      2023-03-17 21:55:31.000000000 
+0100
+++ new/cachetools-5.5.0/tests/test_mru.py      2024-08-18 22:19:09.000000000 
+0200
@@ -1,4 +1,5 @@
 import unittest
+import warnings
 
 from cachetools import MRUCache
 
@@ -6,11 +7,15 @@
 
 
 class MRUCacheTest(unittest.TestCase, CacheTestMixin):
-
+    # TODO: method to create cache that can be overridden
     Cache = MRUCache
 
     def test_evict__writes_only(self):
-        cache = MRUCache(maxsize=2)
+        with warnings.catch_warnings(record=True) as w:
+            warnings.simplefilter("always")
+            cache = MRUCache(maxsize=2)
+        self.assertEqual(len(w), 1)
+        self.assertIs(w[0].category, DeprecationWarning)
 
         cache[1] = 1
         cache[2] = 2
@@ -22,7 +27,11 @@
         assert 3 in cache
 
     def test_evict__with_access(self):
-        cache = MRUCache(maxsize=2)
+        with warnings.catch_warnings(record=True) as w:
+            warnings.simplefilter("always")
+            cache = MRUCache(maxsize=2)
+        self.assertEqual(len(w), 1)
+        self.assertIs(w[0].category, DeprecationWarning)
 
         cache[1] = 1
         cache[2] = 2
@@ -34,7 +43,11 @@
         assert 3 in cache
 
     def test_evict__with_delete(self):
-        cache = MRUCache(maxsize=2)
+        with warnings.catch_warnings(record=True) as w:
+            warnings.simplefilter("always")
+            cache = MRUCache(maxsize=2)
+        self.assertEqual(len(w), 1)
+        self.assertIs(w[0].category, DeprecationWarning)
 
         cache[1] = 1
         cache[2] = 2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cachetools-5.3.3/tests/test_rr.py 
new/cachetools-5.5.0/tests/test_rr.py
--- old/cachetools-5.3.3/tests/test_rr.py       2023-03-17 21:55:31.000000000 
+0100
+++ new/cachetools-5.5.0/tests/test_rr.py       2024-08-18 22:19:09.000000000 
+0200
@@ -6,7 +6,6 @@
 
 
 class RRCacheTest(unittest.TestCase, CacheTestMixin):
-
     Cache = RRCache
 
     def test_rr(self):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cachetools-5.3.3/tests/test_tlru.py 
new/cachetools-5.5.0/tests/test_tlru.py
--- old/cachetools-5.3.3/tests/test_tlru.py     2023-03-17 21:55:31.000000000 
+0100
+++ new/cachetools-5.5.0/tests/test_tlru.py     2024-08-18 22:19:09.000000000 
+0200
@@ -29,7 +29,6 @@
 
 
 class TLRUCacheTest(unittest.TestCase, CacheTestMixin):
-
     Cache = TLRUTestCache
 
     def test_ttu(self):
@@ -157,28 +156,32 @@
         self.assertEqual(2, cache[2])
         self.assertEqual(3, cache[3])
 
-        cache.expire()
+        items = cache.expire()
+        self.assertEqual(set(), set(items))
         self.assertEqual({1, 2, 3}, set(cache))
         self.assertEqual(3, len(cache))
         self.assertEqual(1, cache[1])
         self.assertEqual(2, cache[2])
         self.assertEqual(3, cache[3])
 
-        cache.expire(3)
+        items = cache.expire(3)
+        self.assertEqual({(1, 1)}, set(items))
         self.assertEqual({2, 3}, set(cache))
         self.assertEqual(2, len(cache))
         self.assertNotIn(1, cache)
         self.assertEqual(2, cache[2])
         self.assertEqual(3, cache[3])
 
-        cache.expire(4)
+        items = cache.expire(4)
+        self.assertEqual({(2, 2)}, set(items))
         self.assertEqual({3}, set(cache))
         self.assertEqual(1, len(cache))
         self.assertNotIn(1, cache)
         self.assertNotIn(2, cache)
         self.assertEqual(3, cache[3])
 
-        cache.expire(5)
+        items = cache.expire(5)
+        self.assertEqual({(3, 3)}, set(items))
         self.assertEqual(set(), set(cache))
         self.assertEqual(0, len(cache))
         self.assertNotIn(1, cache)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cachetools-5.3.3/tests/test_ttl.py 
new/cachetools-5.5.0/tests/test_ttl.py
--- old/cachetools-5.3.3/tests/test_ttl.py      2023-03-17 21:55:31.000000000 
+0100
+++ new/cachetools-5.5.0/tests/test_ttl.py      2024-08-18 22:19:09.000000000 
+0200
@@ -26,7 +26,6 @@
 
 
 class TTLCacheTest(unittest.TestCase, CacheTestMixin):
-
     Cache = TTLTestCache
 
     def test_ttl(self):
@@ -132,28 +131,32 @@
         self.assertEqual(2, cache[2])
         self.assertEqual(3, cache[3])
 
-        cache.expire()
+        items = cache.expire()
+        self.assertEqual(set(), set(items))
         self.assertEqual({1, 2, 3}, set(cache))
         self.assertEqual(3, len(cache))
         self.assertEqual(1, cache[1])
         self.assertEqual(2, cache[2])
         self.assertEqual(3, cache[3])
 
-        cache.expire(3)
+        items = cache.expire(3)
+        self.assertEqual({(1, 1)}, set(items))
         self.assertEqual({2, 3}, set(cache))
         self.assertEqual(2, len(cache))
         self.assertNotIn(1, cache)
         self.assertEqual(2, cache[2])
         self.assertEqual(3, cache[3])
 
-        cache.expire(4)
+        items = cache.expire(4)
+        self.assertEqual({(2, 2)}, set(items))
         self.assertEqual({3}, set(cache))
         self.assertEqual(1, len(cache))
         self.assertNotIn(1, cache)
         self.assertNotIn(2, cache)
         self.assertEqual(3, cache[3])
 
-        cache.expire(5)
+        items = cache.expire(5)
+        self.assertEqual({(3, 3)}, set(items))
         self.assertEqual(set(), set(cache))
         self.assertEqual(0, len(cache))
         self.assertNotIn(1, cache)
@@ -192,7 +195,9 @@
 
         cache[1] = 1
         self.assertEqual(1, len(cache))
-        cache.expire(datetime.now())
+        items = cache.expire(datetime.now())
+        self.assertEqual([], list(items))
         self.assertEqual(1, len(cache))
-        cache.expire(datetime.now() + timedelta(days=1))
+        items = cache.expire(datetime.now() + timedelta(days=1))
+        self.assertEqual([(1, 1)], list(items))
         self.assertEqual(0, len(cache))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cachetools-5.3.3/tox.ini new/cachetools-5.5.0/tox.ini
--- old/cachetools-5.3.3/tox.ini        2023-10-24 19:53:07.000000000 +0200
+++ new/cachetools-5.5.0/tox.ini        2024-07-15 21:06:23.000000000 +0200
@@ -32,7 +32,7 @@
 deps =
     flake8
     flake8-black; implementation_name == "cpython"
-    black==22.12.0; implementation_name == "cpython"
+    black==22.12.0; implementation_name == "cpython" and python_version < "3.8"
     flake8-bugbear
     flake8-import-order
 commands =

Reply via email to