mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-64373: Convert _functools
to Argument Clinic (#96640)
This commit is contained in:
parent
5ba4875aec
commit
83cbe84dc2
6 changed files with 185 additions and 32 deletions
|
@ -17,6 +17,7 @@ import weakref
|
|||
import gc
|
||||
from weakref import proxy
|
||||
import contextlib
|
||||
from inspect import Signature
|
||||
|
||||
from test.support import import_helper
|
||||
from test.support import threading_helper
|
||||
|
@ -941,6 +942,10 @@ class TestCmpToKey:
|
|||
self.assertRaises(TypeError, hash, k)
|
||||
self.assertNotIsInstance(k, collections.abc.Hashable)
|
||||
|
||||
def test_cmp_to_signature(self):
|
||||
self.assertEqual(str(Signature.from_callable(self.cmp_to_key)),
|
||||
'(mycmp)')
|
||||
|
||||
|
||||
@unittest.skipUnless(c_functools, 'requires the C _functools module')
|
||||
class TestCmpToKeyC(TestCmpToKey, unittest.TestCase):
|
||||
|
@ -1853,6 +1858,13 @@ class TestLRU:
|
|||
for ref in refs:
|
||||
self.assertIsNone(ref())
|
||||
|
||||
def test_common_signatures(self):
|
||||
def orig(): ...
|
||||
lru = self.module.lru_cache(1)(orig)
|
||||
|
||||
self.assertEqual(str(Signature.from_callable(lru.cache_info)), '()')
|
||||
self.assertEqual(str(Signature.from_callable(lru.cache_clear)), '()')
|
||||
|
||||
|
||||
@py_functools.lru_cache()
|
||||
def py_cached_func(x, y):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue