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

Fix __repr__ for And and Or matchers #7

Merged
merged 1 commit into from Oct 27, 2016
Merged

Conversation

DonaldWhyte
Copy link
Contributor

@DonaldWhyte DonaldWhyte commented Oct 26, 2016

I cannot use the And matcher in my tests, since the test crashes if mock decides to print out the matcher using __repr__. It looks like the __repr__ functions for And and Or incorrectly have the value argument?

I assume these haven't actually been used previously, since these two methods also reference self.matchers instead of the correct self._matchers (which would have been caught earlier if they were actually called).

Let me know if the value arg is intended behaviour. It seems that the value arg is not used though, and it's highly unusual for __repr__() to have more args than just self.

I cannot use the `And` matcher in my tests, since the test crashes if `mock` decides to print out the matcher using `__repr__`. It looks like the `__repr__` functions for `And` and `Or` incorrectly have the `value` attribute?

I assume these haven't actually been used previously, since these two methods also reference `self.matchers` instead of the correct `self._matchers` (which would have been caught earlier if they were actually called).

Let me know if the `value` arg is intended behaviour. It seems that the `value` arg is not used though, and it's highly unusual for `__repr__()` to have more args than just `self`.
@Xion
Copy link
Owner

Xion commented Oct 27, 2016

This is absolutely a bug. __repr__ never takes any arguments.

Thanks for fixing it!

@Xion Xion merged commit e6b388b into Xion:master Oct 27, 2016
@Xion
Copy link
Owner

Xion commented Oct 27, 2016

I made a 0.2.2 release to include this fix.

@DonaldWhyte DonaldWhyte deleted the patch-1 branch October 27, 2016 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants