You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
/home/rodrigo/<ipython console> in <module>()
NameError: name 'be' is not defined
This happens because foo has an or method. When foo | should is evaluated, foo's or is called rather than should's ror. Since ror creates all matchers, if it isn't run, everything breaks.
The text was updated successfully, but these errors were encountered:
I noticed this when I tried to stub things out using dingus; a Dingus overrides all magic operators and returns Dinguses, which is really handy for a property for a test double. It records calls for stubbing, and can return prepared values for mocking. I love it.
But given it implements all operators the alternate operator patch wouldn't solve anything here. The | hack is clever, but not very idiomatic.
Still I couldn't resist hacking up a matcher that checks the .calls of a Dingus in a readable way. The package is called should-dingus.
If the actual object (the left-side one) overrides the or operator, Should-DSL breaks.
will have as result:
This happens because foo has an or method. When foo | should is evaluated, foo's or is called rather than should's ror. Since ror creates all matchers, if it isn't run, everything breaks.
The text was updated successfully, but these errors were encountered: