-
Notifications
You must be signed in to change notification settings - Fork 84
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
test: Add test for iterator exhaustion with next
#2273
test: Add test for iterator exhaustion with next
#2273
Conversation
* Add test to tests/contrib/test_viz.py to cover the case where the wrong labels are somehow returned in brazil.plot_results, causing the legend label ordering logic to fail. * Amends PR # 2264
get_legend_handles_labels = mocker.patch( | ||
"matplotlib.axes._axes.Axes.get_legend_handles_labels", | ||
return_value=(None, ["fail"]), | ||
) | ||
|
||
with pytest.raises(StopIteration): | ||
brazil.plot_results(data["testmus"], data["results"], test_size=0.05, ax=ax) |
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.
This really just causes the error to cover the iterator exhaustion case for next
and so is somewhat of a bad test, but we'd need to add a custom exception here otherwise and I'm not sure if that is worth it.
Codecov ReportPatch coverage has no change and project coverage change:
Additional details and impacted files@@ Coverage Diff @@
## main #2273 +/- ##
==========================================
+ Coverage 98.27% 98.30% +0.02%
==========================================
Files 69 69
Lines 4534 4534
Branches 801 801
==========================================
+ Hits 4456 4457 +1
Misses 45 45
+ Partials 33 32 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
I'm ok with the test looking like this, since this doesn't necessarily mean an impact in actual user-facing code. |
Description
tests/contrib/test_viz.py
to cover the case where the wrong labels are somehow returned inbrazil.plot_results
, causing the legend label ordering logic to fail.Checklist Before Requesting Reviewer
Before Merging
For the PR Assignees: