Skip to content
Merged
Show file tree
Hide file tree
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
Use None check and convert doctest to unittest
  • Loading branch information
tirkarthi committed May 12, 2019
commit 5e9e4e64b093765d1d6b6d0e6fce814440d3b21f
4 changes: 2 additions & 2 deletions Lib/unittest/mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -754,12 +754,12 @@ def _get_call_signature_from_name(self, name):

for name in names:
child = children.get(name)
if not child:
if child is None:
break
else:
children = child._mock_children.get(name)
sig = child._spec_signature
if not children:
if children is None:
break

return sig
Expand Down
8 changes: 8 additions & 0 deletions Lib/unittest/test/testmock/testmock.py
Original file line number Diff line number Diff line change
Expand Up @@ -1368,6 +1368,14 @@ def meth1(self, a, b): pass
)


def test_assert_has_calls_nested_without_spec(self):
m = MagicMock()
m().foo().bar().baz()
m.one().two().three()
calls = call.one().two().three().call_list()
m.assert_has_calls(calls)


def test_assert_has_calls_with_function_spec(self):
def f(a, b, c, d=None): pass

Expand Down