callee icon indicating copy to clipboard operation
callee copied to clipboard

Add on= parameter to Eq

Open Xion opened this issue 8 years ago • 0 comments

Example:

mock_foo.assert_called_with(Eq(expected, on=attrgetter('id')))

which is equivalent to:

mock_foo.assert_called_with(ArgThat(lambda x: x.id == expected.id))

Optionally, if just a string is given to on=, treat it as an implicit argument to attrgetter, e.g. on='id'.

Make key= an alias for on= for consistency with max/min/etc.

Xion avatar Feb 24 '17 01:02 Xion