diff options
author | Chris Withers <chris@withers.org> | 2023-07-11 08:52:12 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-11 08:52:12 (GMT) |
commit | e6379f72cbc60f6b3c5676f9e225d4f145d5693f (patch) | |
tree | f33d21e8ffd9ffc6e43d8f7e5c15f405abd4cf4d /Lib/unittest | |
parent | 4bd8320dd7922d529eab51753dd524e8bf9c47b2 (diff) | |
download | cpython-e6379f72cbc60f6b3c5676f9e225d4f145d5693f.zip cpython-e6379f72cbc60f6b3c5676f9e225d4f145d5693f.tar.gz cpython-e6379f72cbc60f6b3c5676f9e225d4f145d5693f.tar.bz2 |
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
Diffstat (limited to 'Lib/unittest')
-rw-r--r-- | Lib/unittest/mock.py | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py index 3ed54b3..e8c8360 100644 --- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -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) |