afirma pytest para função chamada mais de uma vez
from mock import mock, call
a = SomeObject()
mocked_open = mock.mocked_open()
with mock.patch("builtins.open", mocked_open) as m:
a.function()
handle = m()
# A list of calls that are made to function "file.write"
calls = [call(1), call(2), call(3)]
handle.write.assert_has_calls(calls)
Tense Tarantula