Closed florin-pop closed 1 year ago
Merging #511 (6d4f625) into main (975b44a) will increase coverage by
0.02%
. The diff coverage is97.72%
.
@@ Coverage Diff @@
## main #511 +/- ##
==========================================
+ Coverage 95.44% 95.47% +0.02%
==========================================
Files 69 69
Lines 2791 2830 +39
Branches 400 403 +3
==========================================
+ Hits 2664 2702 +38
Misses 63 63
- Partials 64 65 +1
Impacted Files | Coverage Δ | |
---|---|---|
mne_nirs/io/snirf/tests/test_snirf.py | 97.60% <96.77%> (-0.21%) |
:arrow_down: |
mne_nirs/io/snirf/_snirf.py | 95.94% <100.00%> (+0.14%) |
:arrow_up: |
mne_nirs/statistics/tests/test_glm_type.py | 100.00% <100.00%> (ø) |
Great PR @florin-pop. I made some suggestions that I think will simplify the code and slightly boost test coverage. Could you please check if they actually work? And add a changelog entry then ping us for a review/merge. Thanks!
@larsoner I noticed that after you merged https://github.com/mne-tools/mne-python/pull/11665 this line started failing in CI https://github.com/mne-tools/mne-nirs/blob/975b44a1888e9b8173df7a2f718035e409d79b06/mne_nirs/statistics/tests/test_glm_type.py#L114
Should we replace it with:
with pytest.raises(ValueError, match='could not be picked'):
?
I was thinking of doing something like:
if check_version(mne.__version__, '1.4.0'):
expected_pick_failure = ValueError
else:
expected_pick_failure = Warning
with pytest.raises(expected_pick_failure, match='could not be picked'):
assert len(res.copy().pick(picks=["S1_D1 hbr", "S1_D1 XXX"])) == 1
but I'm not sure check_version
works as expected
>>> import mne
>>> from mne.utils import check_version
>>> print(mne.__version__)
1.4.0.dev136+g263114e32
>>> print(check_version(mne.__version__, '1.4.0', return_version=True))
(False, None)
I would use mne.fixes._compare_version
since it behaves as you'd expect/need here, and the pattern I usually use is:
if _compare_version(mne.__version__, '>=', '1.4'):
ctx = pytest.raises(ValueError, match='...')
else:
ctx = pytest.warns(RuntimeWarning, match='...')
with ctx:
...
Tests are green. Thanks @florin-pop @larsoner
Fixes https://github.com/mne-tools/mne-nirs/issues/456
Write optical density data in SNIRF format.
Example usage:
Contributed with ❤️ by AE Studio