-
Notifications
You must be signed in to change notification settings - Fork 83
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
chore: [pre-commit.ci] pre-commit autoupdate #2264
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #2264 +/- ##
==========================================
- Coverage 98.30% 98.27% -0.03%
==========================================
Files 69 69
Lines 4534 4534
Branches 802 801 -1
==========================================
- Hits 4457 4456 -1
Misses 45 45
- Partials 32 33 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
updates: - [github.com/astral-sh/ruff-pre-commit: v0.0.276 → v0.0.281](astral-sh/ruff-pre-commit@v0.0.276...v0.0.281) - [github.com/psf/black: 23.3.0 → 23.7.0](psf/black@23.3.0...23.7.0) - [github.com/asottile/blacken-docs: 1.14.0 → 1.15.0](adamchainz/blacken-docs@1.14.0...1.15.0)
for more information, see https://pre-commit.ci
a2d44b4
to
b8faaa6
Compare
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.
It is unclear to me why coverage
is reporting the [0]
case as being fully covered but the next
case as only partial coverage. :?
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.
Ah. Seems because help(next)
shows
Help on built-in function next in module builtins:
next(...)
next(iterator[, default])
Return the next item from the iterator. If default is given and the iterator
is exhausted, it is returned instead of raising StopIteration.
that nedbat/coveragepy#605 (comment) and nedbat/coveragepy#1617 might be relevant here.
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.
@kratsg Is there a way to mock or do something else to get
pyhf/tests/contrib/test_viz.py
Lines 16 to 23 in 6c35247
def test_brazil_band_collection(datadir): | |
data = json.load(datadir.joinpath("hypotest_results.json").open(encoding="utf-8")) | |
fig = Figure() | |
ax = fig.subplots() | |
brazil_band_collection = brazil.plot_results( | |
data["testmus"], data["results"], test_size=0.05, ax=ax | |
) |
to cause
pyhf/src/pyhf/contrib/viz/brazil.py
Lines 360 to 366 in 6c35247
# Order legend: ensure CLs expected band and test size are last in legend | |
handles, labels = ax.get_legend_handles_labels() | |
if not no_cls: | |
for label_part in ["exp", "pm1", "pm2", "alpha"]: | |
label_idx = [ | |
idx for idx, label in enumerate(labels) if label_part in label | |
][0] |
to raise a StopIteration
when switched to using next
? So to mock the value of labels
such that one of the label_part
values aren't found?
By construction the function should always get the values, so this might be an area where the dip in the test coverage by partial for 1 line is worth it.
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.
Yeah, this can just be mocked and so can just be a follow up PR.
updates: