Skip to content

Commit b82bf18

Browse files
author
v01dxyz
committed
Pre-commit test for removing hardcoded "BAD_blink" in interpolate_blink
Related to #13531
1 parent 8dd298f commit b82bf18

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

mne/preprocessing/eyetracking/tests/test_pupillometry.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,19 @@
1919
@pytest.mark.parametrize(
2020
"buffer, match, cause_error, interpolate_gaze, crop",
2121
[
22-
(0.025, "BAD_blink", False, False, False),
23-
(0.025, "BAD_blink", False, True, True),
22+
(0.025, "WRONG_blink", False, False, False),
23+
(0.025, "WRONG_blink", False, True, True),
24+
(0.025, "WRONG_blink", False, True, True),
2425
((0.025, 0.025), ["random_annot"], False, False, False),
25-
(0.025, "BAD_blink", True, False, False),
26+
(0.025, "WRONG_blink", True, False, False),
2627
],
2728
)
2829
def test_interpolate_blinks(buffer, match, cause_error, interpolate_gaze, crop):
2930
"""Test interpolating pupil data during blinks."""
3031
raw = read_raw_eyelink(fname, create_annotations=["blinks"], find_overlaps=True)
32+
# we rename BAD_blink in order to test if it works with another description.
33+
raw.annotations.rename({"BAD_blink": "WRONG_blink"})
34+
3135
if crop:
3236
raw.crop(tmin=2)
3337
assert raw.first_time == 2.0
@@ -38,8 +42,9 @@ def test_interpolate_blinks(buffer, match, cause_error, interpolate_gaze, crop):
3842
stim_raw = RawArray(stim_data, info)
3943
raw.add_channels([stim_raw], force_update_info=True)
4044

45+
description = "WRONG_blink"
4146
# Get the indices of the first blink
42-
blink_starts, blink_ends = _annotations_starts_stops(raw, "BAD_blink")
47+
blink_starts, blink_ends = _annotations_starts_stops(raw, description)
4348
blink_starts = np.divide(blink_starts, raw.info["sfreq"])
4449
blink_ends = np.divide(blink_ends, raw.info["sfreq"])
4550
first_blink_start = blink_starts[0]
@@ -52,7 +57,7 @@ def test_interpolate_blinks(buffer, match, cause_error, interpolate_gaze, crop):
5257

5358
if cause_error:
5459
# Make an annotation without ch_names info
55-
raw.annotations.append(onset=1, duration=1, description="BAD_blink")
60+
raw.annotations.append(onset=1, duration=1, description=description)
5661
with pytest.raises(ValueError):
5762
interpolate_blinks(raw, buffer=buffer, match=match)
5863
return

0 commit comments

Comments
 (0)