summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_functools.py
Commit message (Collapse)AuthorAgeFilesLines
* [3.12] gh-90805: Make sure test_functools works with and without ↵Miss Islington (bot)2023-09-121-30/+28
| | | | | | | | _functoolsmodule (GH-108644) (#109275) gh-90805: Make sure test_functools works with and without _functoolsmodule (GH-108644) (cherry picked from commit baa6dc8e388e71b2a00347143ecefb2ad3a8e53b) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
* [3.12] gh-106292: restore checking __dict__ in cached_property.__get__ ↵Miss Islington (bot)2023-07-051-0/+19
| | | | | | | | | | | | (GH-106380) (#106469) gh-106292: restore checking __dict__ in cached_property.__get__ (GH-106380) * gh-106292: restore checking __dict__ in cached_property.__get__ (cherry picked from commit 838406b4fc044c0b2f397c23275c69f16a76205b) Co-authored-by: Carl Meyer <carl@oddbird.net> Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
* gh-104600: Make function.__type_params__ writable (#104601)Jelle Zijlstra2023-05-181-1/+3
|
* gh-77757: replace exception wrapping by PEP-678 notes in typeobject's ↵Irit Katriel2023-04-111-2/+2
| | | | __set_name__ (#103402)
* gh-87634: remove locking from functools.cached_property (GH-101890)Carl Meyer2023-02-231-36/+0
| | | Remove the undocumented locking capabilities of functools.cached_property.
* gh-64373: Convert `_functools` to Argument Clinic (#96640)Nikita Sobolev2022-10-071-0/+12
|
* Fix misused variable that was preventing permutations of classes from being ↵Jingxuan He2022-07-281-1/+1
| | | | tested (GH-93935)
* gh-84623: Remove unused imports in tests (#93772)Victor Stinner2022-06-131-2/+0
|
* gh-90172: add test for functools.singledispatch on Union types with None ↵Thaddeus14992022-05-031-0/+43
| | | | | | | type (#92174) Signed-off-by: prwatson <prwatson@redhat.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* bpo-40280: Detect missing threading on WASM platforms (GH-32352)Christian Heimes2022-04-071-0/+4
| | | Co-authored-by: Brett Cannon <brett@python.org>
* bpo-46998: Allow subclassing Any at runtime (GH-31841)Shantanu2022-04-051-8/+0
| | | Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* bpo-46388: Test NotImplemented code path for functools.total_ordering (GH-30616)Russel Webber2022-01-151-0/+67
|
* bpo-46380: Apply tests to both C and Python version (GH-30606)Nikita Sobolev2022-01-141-3/+3
|
* bpo-46032: Check types in singledispatch's register() at declaration time ↵Serhiy Storchaka2021-12-251-0/+68
| | | | | | | | | (GH-30050) The registry() method of functools.singledispatch() functions checks now the first argument or the first parameter annotation and raises a TypeError if it is not supported. Previously unsupported "types" were ignored (e.g. typing.List[int]) or caused an error at calling time (e.g. list[int]).
* bpo-46014: Add ability to use typing.Union with singledispatch (GH-30017)Yurii Karabas2021-12-101-0/+30
|
* bpo-45679: add `tuple` tests with `lru_cache` to `test_functools` (GH-29339)Nikita Sobolev2021-11-051-0/+27
|
* bpo-45678: Add more ``singledispatchmethod`` tests (GH-29412)Alex Waygood2021-11-051-0/+99
| | | | | | | In order to fix a bug in the 3.9 branch in #29394, more tests were added to ``test_functools.py`` to ensure that ``singledispatchmethod`` still correctly wrapped a target method, even if the target method had already been wrapped by multiple other decorators. This PR brings the new tests into the 3.11 and 3.10 branches as well.
* bpo-45678: Add ``functools.singledispatchmethod`` tests (GH-29328)Alex Waygood2021-11-031-1/+41
|
* bpo-39679: Add tests for classmethod/staticmethod singledispatchmethods ↵Alex Waygood2021-10-191-0/+42
| | | | | | | | | | | | | (GH-29034) In Python 3.8 and 3.9, stacking `@functools.singledispatchmethod` on top of `@classmethod` or `@staticmethod` caused an exception to be raised if the method was registered using type-annotations rather than `@method.register(int)`. This was not caught by unit tests, however, as the tests only tested the `@method.register(int)` way of registering additional implementations. The bug is no longer present in Python 3.10+, but `test_functools.py` is still lacking regression tests for these cases. This commit adds these test cases.
* bpo-25130: Add calls of gc.collect() in tests to support PyPy (GH-28005)Serhiy Storchaka2021-08-291-0/+1
|
* bpo-44605: Teach @total_ordering() to work with metaclasses (GH-27633)Raymond Hettinger2021-08-061-0/+28
|
* bpo-43988: Use check disallow instantiation helper (GH-26392)Erlend Egeberg Aasland2021-05-271-2/+3
|
* bpo-43916: Apply Py_TPFLAGS_DISALLOW_INSTANTIATION to selected types (GH-25748)Erlend Egeberg Aasland2021-04-301-0/+6
| | | | | | | | | | | | | | | | | | | | | Apply Py_TPFLAGS_DISALLOW_INSTANTIATION to the following types: * _dbm.dbm * _gdbm.gdbm * _multibytecodec.MultibyteCodec * _sre..SRE_Scanner * _thread._localdummy * _thread.lock * _winapi.Overlapped * array.arrayiterator * functools.KeyWrapper * functools._lru_list_elem * pyexpat.xmlparser * re.Match * re.Pattern * unicodedata.UCD * zlib.Compress * zlib.Decompress
* bpo-38605: Revert making 'from __future__ import annotations' the default ↵Pablo Galindo2021-04-211-2/+2
| | | | | | (GH-25490) This reverts commits 044a1048ca93d466965afc027b91a5a9eb9ce23c and 1be456ae9d53bb1cba2b24fc86175c282d1c2169, adapting the code to changes that happened after it.
* bpo-40137: Convert _functools module to use PyType_FromModuleAndSpec. (GH-23405)Hai Shi2020-12-291-2/+1
|
* bpo-38605: Make 'from __future__ import annotations' the default (GH-20434)Batuhan Taskaya2020-10-061-2/+2
| | | | | The hard part was making all the tests pass; there are some subtle issues here, because apparently the future import wasn't tested very thoroughly in previous Python versions. For example, `inspect.signature()` returned type objects normally (except for forward references), but strings with the future import. We changed it to try and return type objects by calling `typing.get_type_hints()`, but fall back on returning strings if that function fails (which it may do if there are future references in the annotations that require passing in a specific namespace to resolve).
* bpo-40275: Use new test.support helper submodules in tests (GH-21219)Hai Shi2020-06-301-3/+6
|
* bpo-17005: Move topological sort functionality to its own module (GH-20558)Pablo Galindo2020-05-311-270/+1
| | | | | | The topological sort functionality that was introduced initially in the functools module has been moved to a new graphlib module to better accommodate the new tools and keep the original scope of the functools module.
* bpo-40275: Adding threading_helper submodule in test.support (GH-20263)Hai Shi2020-05-271-5/+6
|
* bpo-40571: Make lru_cache(maxsize=None) more discoverable (GH-20019)Raymond Hettinger2020-05-121-0/+19
|
* bpo-40504: Allow weakrefs to lru_cache objects (GH-19938)Dennis Sweeney2020-05-051-0/+31
|
* bpo-17005: Add a class to perform topological sorting to the standard ↵Pablo Galindo2020-01-231-1/+273
| | | | | library (GH-11583) Co-Authored-By: Tim Peters <tim.peters@gmail.com>
* bpo-38565: add new cache_parameters method for lru_cache (GH-16916)Manjusaka2019-11-121-0/+11
|
* [3.9] bpo-37116: Use PEP 570 syntax for positional-only parameters. (GH-12620)Serhiy Storchaka2019-06-051-3/+1
| | | Turn deprecation warnings added in 3.8 into TypeError.
* bpo-36772 Allow lru_cache to be used as decorator without making a function ↵Raymond Hettinger2019-05-261-7/+12
| | | | call (GH-13048)
* bpo-35252: Remove FIXME from test_functools (GH-10551)Lysandros Nikolaou2019-05-191-6/+5
|
* bpo-36540: PEP 570 -- Implementation (GH-12701)Pablo Galindo2019-04-291-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit contains the implementation of PEP570: Python positional-only parameters. * Update Grammar/Grammar with new typedarglist and varargslist * Regenerate grammar files * Update and regenerate AST related files * Update code object * Update marshal.c * Update compiler and symtable * Regenerate importlib files * Update callable objects * Implement positional-only args logic in ceval.c * Regenerate frozen data * Update standard library to account for positional-only args * Add test file for positional-only args * Update other test files to account for positional-only args * Add News entry * Update inspect module and related tests
* bpo-36650: Fix handling of empty keyword args in C version of lru_cache. ↵Raymond Hettinger2019-04-201-0/+14
| | | | (GH-12881)
* bpo-36492: Deprecate passing some arguments as keyword arguments. (GH-12637)Serhiy Storchaka2019-04-011-0/+11
| | | | | | | | | | | | | | | | | | | | | | Deprecated passing the following arguments as keyword arguments: - "func" in functools.partialmethod(), weakref.finalize(), profile.Profile.runcall(), cProfile.Profile.runcall(), bdb.Bdb.runcall(), trace.Trace.runfunc() and curses.wrapper(). - "function" in unittest.addModuleCleanup() and unittest.TestCase.addCleanup(). - "fn" in the submit() method of concurrent.futures.ThreadPoolExecutor and concurrent.futures.ProcessPoolExecutor. - "callback" in contextlib.ExitStack.callback(), contextlib.AsyncExitStack.callback() and contextlib.AsyncExitStack.push_async_callback(). - "c" and "typeid" in the create() method of multiprocessing.managers.Server and multiprocessing.managers.SharedMemoryServer. - "obj" in weakref.finalize(). Also allowed to pass arbitrary keyword arguments (even "self" and "func") if the above arguments are passed as positional argument.
* bpo-35780: Fix errors in lru_cache() C code (GH-11623)Raymond Hettinger2019-01-261-1/+28
|
* bpo-32321: Add pure Python fallback for functools.reduce (GH-8548)madman-bob2018-10-251-32/+39
|
* bpo-21145: Add cached_property decorator in functools (#6982)Carl Meyer2018-08-281-0/+166
| | | | | | Robust caching of calculated properties is harder than it looks at first glance, so add a solid, well-tested implementation to the standard library.
* bpo-33967: Fix wrong use of assertRaises (GH-8306)INADA Naoki2018-07-171-1/+1
|
* bpo-33967: Remove use of deprecated assertRaisesRegexp() (GH-8261)Zackery Spytz2018-07-121-1/+1
| | | It was added in test_functools at 445f1b3.
* bpo-33967: Fix singledispatch raised IndexError when no args (GH-8184)Dong-hee Na2018-07-101-0/+7
|
* bpo-32380: Create functools.singledispatchmethod (#6306)Ethan Smith2018-05-261-0/+118
|
* bpo-32297: Few misspellings found in Python source code comments. (#4803)Mike2017-12-141-1/+1
| | | | | | | | * Fix multiple typos in code comments * Add spacing in comments (test_logging.py, test_math.py) * Fix spaces at the beginning of comments in test_logging.py
* bpo-32227: functools.singledispatch supports registering via type ↵Łukasz Langa2017-12-111-0/+68
| | | | annotations (#4733)
* bpo-31581: Reduce the number of imports for functools (GH-3757)INADA Naoki2017-09-301-83/+84
|
* bpo-31370: Remove support for threads-less builds (#3385)Antoine Pitrou2017-09-071-7/+1
| | | | | | * Remove Setup.config * Always define WITH_THREAD for compatibility.