Skip to content

Remove unused branches from mock module #106617

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Lib/test/test_unittest/testmock/testthreadingmock.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

class Something:
def method_1(self):
pass
pass # pragma: no cover

def method_2(self):
pass
pass # pragma: no cover


class TestThreadingMock(unittest.TestCase):
Expand Down
7 changes: 1 addition & 6 deletions Lib/unittest/mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down