Partially assert callable arguments with 'unittest.mock.ANY'

from blog Redowan's Reflections, | ↗ original
↗ original
I just found out that you can use Python’s unittest.mock.ANY to make assertions about certain arguments in a mock call, without caring about the other arguments. This can be handy if you want to test how a callable is called but only want to make assertions about some arguments. Consider the following example: # test_src.py import random import...