Assert that a method was called with one argument out of several

You can also use the ANY helper to always match arguments you don’t know or aren’t checking for.

More on the ANY helper:
https://docs.python.org/3/library/unittest.mock.html#any

So for instance you could match the argument ‘session’ to anything like so:

from unittest.mock import ANY
requests_arguments = {'slug': 'foo', 'session': ANY}
requests.post.assert_called_with(requests_arguments)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)