Skip to content

Commit fc85ca7

Browse files
committed
FIX: Update test
1 parent a6a6eb1 commit fc85ca7

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

mne/epochs.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1919,8 +1919,10 @@ def _drop_log_stats(drop_log, ignore=('IGNORED',)):
19191919
perc : float
19201920
Total percentage of epochs dropped.
19211921
"""
1922-
if not isinstance(drop_log, tuple) or not isinstance(drop_log[0], tuple):
1923-
raise ValueError('drop_log must be a tuple of tuples')
1922+
if not isinstance(drop_log, tuple) or \
1923+
not all(isinstance(d, tuple) for d in drop_log) or \
1924+
not all(isinstance(s, str) for d in drop_log for s in d):
1925+
raise TypeError('drop_log must be a tuple of tuple of str')
19241926
perc = 100 * np.mean([len(d) > 0 for d in drop_log
19251927
if not any(r in ignore for r in d)])
19261928
return perc

mne/viz/tests/test_epochs.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,12 @@ def test_plot_drop_log():
269269
pytest.raises(ValueError, epochs.plot_drop_log)
270270
epochs.drop_bad()
271271
epochs.plot_drop_log()
272-
plot_drop_log([['One'], [], []])
273-
plot_drop_log([['One'], ['Two'], []])
274-
plot_drop_log([['One'], ['One', 'Two'], []])
272+
plot_drop_log((('One',), (), ()))
273+
plot_drop_log((('One',), ('Two',), ()))
274+
plot_drop_log((('One',), ('One', 'Two'), ()))
275+
for arg in ([], ([],), (1,)):
276+
with pytest.raises(TypeError, match='tuple of tuple of str'):
277+
plot_drop_log(arg)
275278
plt.close('all')
276279

277280

0 commit comments

Comments
 (0)