Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Merge branch 'master' into minor-fixes
  • Loading branch information
voidspace authored Sep 13, 2019
commit 8c2ab3b9c1d80d5e318d7752f71aa21fef8aaaa8
19 changes: 19 additions & 0 deletions Lib/unittest/mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -1013,8 +1013,27 @@ def _calls_repr(self, prefix="Calls"):
return ""
return f"\n{prefix}: {safe_repr(self.mock_calls)}."


_MOCK_SIG = inspect.signature(NonCallableMock.__init__)


class _AnyComparer(list):
"""A list which checks if it contains a call which may have an
argument of ANY, flipping the components of item and self from
their traditional locations so that ANY is guaranteed to be on
the left."""
def __contains__(self, item):
for _call in self:
if len(item) != len(_call):
continue
if all([
expected == actual
for expected, actual in zip(item, _call)
]):
return True
return False


def _try_iter(obj):
if obj is None:
return obj
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.