Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add on= parameter to Eq #8

Open
Xion opened this issue Feb 24, 2017 · 0 comments
Open

Add on= parameter to Eq #8

Xion opened this issue Feb 24, 2017 · 0 comments

Comments

@Xion
Copy link
Owner

Xion commented Feb 24, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant