mirror of
https://github.com/python/cpython.git
synced 2024-11-23 18:04:37 +08:00
Remove unused branches from mock module (#106617)
* lambda has a name of __none__, but no async lambda so this branch is not needed * _get_signature_object only returns None for bound builtins. There are no async builtins so this branch isn't needed * Exclude a couple of methods from coverage checking in the downstream rolling backport of mock
This commit is contained in:
parent
4bd8320dd7
commit
e6379f72cb
@ -11,10 +11,10 @@ threading_helper.requires_working_threading(module=True)
|
||||
|
||||
class Something:
|
||||
def method_1(self):
|
||||
pass
|
||||
pass # pragma: no cover
|
||||
|
||||
def method_2(self):
|
||||
pass
|
||||
pass # pragma: no cover
|
||||
|
||||
|
||||
class TestThreadingMock(unittest.TestCase):
|
||||
|
@ -212,17 +212,12 @@ def _set_async_signature(mock, original, instance=False, is_async_mock=False):
|
||||
# signature as the original.
|
||||
|
||||
skipfirst = isinstance(original, type)
|
||||
result = _get_signature_object(original, instance, skipfirst)
|
||||
if result is None:
|
||||
return mock
|
||||
func, sig = result
|
||||
func, sig = _get_signature_object(original, instance, skipfirst)
|
||||
def checksig(*args, **kwargs):
|
||||
sig.bind(*args, **kwargs)
|
||||
_copy_func_details(func, checksig)
|
||||
|
||||
name = original.__name__
|
||||
if not name.isidentifier():
|
||||
name = 'funcopy'
|
||||
context = {'_checksig_': checksig, 'mock': mock}
|
||||
src = """async def %s(*args, **kwargs):
|
||||
_checksig_(*args, **kwargs)
|
||||
|
Loading…
Reference in New Issue
Block a user