-
Notifications
You must be signed in to change notification settings - Fork 989
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
Make EqualsTester notice incorrect delegation #3809
Conversation
Cirq is secretly just a test of places where Sympy fails to be pythonic? |
I just reran your checks as well on this PR to see the difference, couldn't repro the lint error yet on this branch. And now it passed. Very odd. XRef #3716. |
@Strilanc probably the best one to look at this sense he wrote the original definition of the problem (and there seems to be a slight difference in what he said, since we don't need a fallback to reference checking to get this work). |
@balopat this could use a triage to a reviewer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comments in the test here are incredibly helpful for parsing it, thanks!
One nit and this is good to go.
tx @95-martin-orion ! |
This extends EqualsTester to notice when someone incorrectly does not return NotImplemented in
__eq__
for objects of an unrecognized type. Doing this can cause commutativity to fail when implementing other objects that should be equal to this object. (It was worse in python 2, where depending on whether one inherited from object or not could cause this).This also fixes places where Cirq code was doing this incorrectly.
Fixes #877
One final note is that the
eigen_gate_test
was changed because apparently Sympy does this incorrectly