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.
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
#11679 LoopingCall vs Clock tests #11680
#11679 LoopingCall vs Clock tests #11680
Changes from 2 commits
77368c6
90b1572
4825f8b
8ee190c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
I guess we can also have the test like this
And my understanding is that this is is how the tests will be refactored after the Clock is fixed.
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.
Because of the assertion on line 512 (accumulator == [1] * 5) the clock/reactor will still need to iterate 5 times. It is the old, broken behavior that makes
clock.advance(0)
run the LoopingCall 5 times.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.
Just asking.
Is there any advantage in this way of writing the test?
I prefer to have the assertions as "dumb" as possible, to reduce the risk of errors...to the extend of having more repetition.
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.
I think you're asking about
[1, 1, 1, 1, 1]
vs[1] * 5
? I think I find[1] * 5
to be the less risky version. My eyes slide over[1, 1, 1, 1, 1]
very easily but the exact number of 1s there is absolutely critical to the correctness of the test.Probably there is some other pattern altogether that is better than either of these, keeping things simpler than list multiplication but also making it easy to read without making a mistake. I didn't think very hard about finding such a pattern while working on this.