-
Notifications
You must be signed in to change notification settings - Fork 37
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
Refactor Aggregation Tests #645
Conversation
Codecov Report
@@ Coverage Diff @@
## master #645 +/- ##
=======================================
Coverage 79.84% 79.84%
=======================================
Files 33 33
Lines 3195 3195
Branches 682 682
=======================================
Hits 2551 2551
Misses 507 507
Partials 137 137 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
@kidrahahjo I like the idea of making our test files more modular, but I would caution against using a directory named |
Okay! I will make it similar to that of the module. |
This PR should then do some additional work as well. I think refactoring aggregation tests would be great for the scope of this PR. |
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.
Revert unrelated change
Requesting @b-butler to review this, since I've written most of the aggregation tests with him. |
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 left some comments and suggestions to address.
tests/test_aggregates.py
Outdated
def create_aggregate_store(self, aggregator_instance, project): | ||
return aggregator_instance._create_AggregateStore(project) |
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 call aggregator_instance._create_AggregatorStore(project)
directly.
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 could call it directly, but it makes the code look more clean IMO. Happy to change this if you want
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.
The reason I'm stating this though is that if I remove this then I'll have to add multiple lines of code for initializing the aggregator_instance first. It might be painful to do that but if the current one is against best practices then I'm happy to change this.
@b-butler what do you suggest?
tests/test_aggregates.py
Outdated
assert list(aggregate_instance._aggregator_function(agg_value)) == [ | ||
tuple(agg_value) | ||
] |
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.
assert list(aggregate_instance._aggregator_function(agg_value)) == [ | |
tuple(agg_value) | |
] | |
assert next(aggregate_instance._aggregator_function(agg_value)) == tuple(agg_value) |
Also, this check seems a bit off to me. I get that we just wrap anything passed in a tuple by default, but this isn't really what the default aggregator is for. At the very least we should comment why this check exists.
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 don't think we should be choosing the first element here using next
because we need to make sure that the output of _aggregator_function
is everything grouped into 1.
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 get your thoughts, just testing the aggregator on random input feels off. We also don't need to parameterize this test.
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.
Hmm, let's remove the parameters but are you suggesting to remove this test instead?
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 removed the parameters, let me know how it looks
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.
Looks good. Approving since addressing Brandon's comments should be sufficient.
…test-refactor/structuring
@b-butler how does everything here look to you now? It looks like you're pretty deep into the review already and it's probably easier for you to finish than to bring in anyone else, but feel free to ping if it needs another eye. |
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.
👍
Merging this as it has two approvals. |
Description
Refactor tests written for
aggregates.py
Motivation and Context
Refer to #611
Checklist: