Description
Python's rich comparison methods should return NotImplemented so that the RHS of a comparison is given the opportunity to implement the comparison.
In my case, I have a test snapshot fixture such that I can do assert figure == snapshot.
Screenshots/Video
N/A
Steps to reproduce
importplotly.graph_objectsasgoclassMyObject:
def__eq__(self, other):
print(f"MyObject.__eq__({other!r}) called")
returnNotImplementedprint(1==MyObject())
print(go.Figure() ==MyObject())MyObject.__eq__(1) called
False
False
There should be a print of MyObject.__eq__(Figure({...})) called.
Description
Python's rich comparison methods should return
NotImplementedso that the RHS of a comparison is given the opportunity to implement the comparison.In my case, I have a test snapshot fixture such that I can do
assert figure == snapshot.Screenshots/Video
N/A
Steps to reproduce
There should be a print of
MyObject.__eq__(Figure({...})) called.