Skip to content

Commit 30254ce

Browse files
committed
TST: Make it break
1 parent 828953e commit 30254ce

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

mne/io/eyelink/tests/test_eyelink.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,43 @@ def test_find_overlaps():
193193
assert overlap_df["eye"].iloc[0] == "both"
194194

195195

196+
@requires_testing_data
197+
@pytest.mark.parametrize("fname", [fname])
198+
def test_bino_to_mono(tmp_path, fname):
199+
"""Test a file that switched from binocular to monocular mid-recording."""
200+
out_file = tmp_path / "tmp_eyelink.asc"
201+
in_file = Path(fname)
202+
203+
with in_file.open() as file:
204+
lines = file.readlines()
205+
end_line = lines[-2]
206+
end_ts = int(end_line.split("\t")[1])
207+
# Now only left eye data
208+
second_block = []
209+
new_ts = end_ts + 1
210+
info = ["GAZE", "LEFT", "RATE", "500.00", "TRACKING", "CR", "FILTER", "2"]
211+
start = ["START", f"{new_ts}", "LEFT", "SAMPLES", "EVENTS"]
212+
samples = ["SAMPLES"] + info
213+
events = ["EVENTS"] + info
214+
second_block.append("\t".join(start) + "\n")
215+
second_block.append("\t".join(samples) + "\n")
216+
second_block.append("\t".join(events) + "\n")
217+
# Some fake data
218+
left = ["960", "540", "0.0", "..."] # x, y, pupil, status
219+
NUM_FAKE_SAMPLES = 10
220+
for ii in range(NUM_FAKE_SAMPLES):
221+
ts = new_ts + ii
222+
tokens = [f"{ts}"] + left
223+
second_block.append("\t".join(tokens) + "\n")
224+
end_ts = ts + 1
225+
end_block = ["END", f"{end_ts}", "SAMPLES", "EVENTS", "RES", "45", "45"]
226+
second_block.append("\t".join(end_block))
227+
lines += second_block
228+
with out_file.open("w") as file:
229+
file.writelines(lines)
230+
assert read_raw_eyelink(out_file)
231+
232+
196233
def _simulate_eye_tracking_data(in_file, out_file):
197234
out_file = Path(out_file)
198235

0 commit comments

Comments
 (0)