I am writing several unittests for some code that uses SQLAlchemy. I want to test filter calls, but it seems that SQLAlchemy BinaryExpression objects created with the same arguments are not compared equal:
AssertionError: Expected call: filter(<sqlalchemy.sql.elements.BinaryExpression object at 0x1037607d0>) Actual call: filter(<sqlalchemy.sql.elements.BinaryExpression object at 0x1037590d0>)
I believe that I can relate them both to strings and compare them, but this seems to be hacked, and I would prefer not to try to debug string comparisons if I don't need it. Are there any better / more structured ways to compare BinaryExpression in unittests?
source share