diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-12-28 21:58:07 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-12-28 21:58:07 (GMT) |
commit | e4d65e3aab980cd8c2347d71bc6e26c19227953b (patch) | |
tree | d6346ffe9e07b111427262150f942d941b18830a /Lib/test | |
parent | 762d5ea8753e2c137eb7affa9fcb51db1cecd1aa (diff) | |
download | cpython-e4d65e3aab980cd8c2347d71bc6e26c19227953b.zip cpython-e4d65e3aab980cd8c2347d71bc6e26c19227953b.tar.gz cpython-e4d65e3aab980cd8c2347d71bc6e26c19227953b.tar.bz2 |
Issue #25447: Copying the lru_cache() wrapper object now always works,
independedly from the type of the wrapped object (by returning the original
object unchanged).
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_functools.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py index d822b2d..cf0b95d 100644 --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -1262,14 +1262,24 @@ class TestLRU: def test_copy(self): cls = self.__class__ - for f in cls.cached_func[0], cls.cached_meth, cls.cached_staticmeth: + def orig(x, y): + return 3 * x + y + part = self.module.partial(orig, 2) + funcs = (cls.cached_func[0], cls.cached_meth, cls.cached_staticmeth, + self.module.lru_cache(2)(part)) + for f in funcs: with self.subTest(func=f): f_copy = copy.copy(f) self.assertIs(f_copy, f) def test_deepcopy(self): cls = self.__class__ - for f in cls.cached_func[0], cls.cached_meth, cls.cached_staticmeth: + def orig(x, y): + return 3 * x + y + part = self.module.partial(orig, 2) + funcs = (cls.cached_func[0], cls.cached_meth, cls.cached_staticmeth, + self.module.lru_cache(2)(part)) + for f in funcs: with self.subTest(func=f): f_copy = copy.deepcopy(f) self.assertIs(f_copy, f) |