Fix subtraction of TimeDuration of, and from, Data
#288
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Close #287 and add a test to capture it that bug, as well as a similar bug with a different traceback emering if the inverse is tried i..e the data subtracted from the timeduration (which I guess makes sense and should work, though isn't a very natural operation), namely (this report results from adding the new test lines to the
masterbranch:where commenting our the
t2 = dt - daline and anything referring tot2reveals the error Dan reported (for the full traceback it is:)Fix suggestion
@davidhassell my suggestion is to change the implementation of
__rsub__to that shown, especially given the equivalently simple implementations of__radd__and__rmul__, though because those are commutative andsubisn't, I would like to check that the idea is OK - perhaps relating to the non-commutativity__rsub__must be done differently? If so, happy to change the approach, but something about the current implementation certainly isn't working and needs to be fixed and/or changed, and my suggestion does work at least...