Page MenuHomeSoftware Heritage
Paste P990

pytest wat
ActivePublic

Authored by vlorentz on Mar 25 2021, 5:45 PM.
def test_foo():
from unittest.mock import MagicMock, call
f = MagicMock()
f("foo", [b"bar"])
f("foo", [b"baz"])
f.assert_has_calls(
[
call("foo", ["bar"]),
call("foo", ["baz"]),
],
> any_order=True
)
E AssertionError: (call('foo', ['bar']), call('foo', ['baz'])) not all found in call list
E
E pytest introspection follows:
E
E Args:
E assert ('foo', [b'baz']) == ([call('foo', ['bar']), call('foo', ['baz'])],)
E At index 0 diff: 'foo' != [call('foo', ['bar']), call('foo', ['baz'])]
E Left contains one more item: [b'baz']
E Full diff:
E - ([call('foo', ['bar']), call('foo', ['baz'])],)
E + ('foo', [b'baz'])
E Kwargs:
E assert {} == {'any_order': True}
E Right contains 1 more item:
E {'any_order': True}
E Full diff:
E - {'any_order': True}
E + {}