Tests fail on Python 3.7 - call.args[0] == "args"
#4
Labels
quality
Tech debt / refactoring to make the code easier to work on
call.args[0] == "args"
#4
In Python 3.7, a mock call is a tuple. From 3.8 onwards it's a named tuple. In 3.7,
assert [c.args[0] for c in mocked_item.mock_calls] = ["a", "b", "c"]
does something non-obvious like create a method namedargs
, and[0]
returns its name.Solution is to access the call's args by its position in the tuple -
some_call[1]
notsome_call.args
The text was updated successfully, but these errors were encountered: