Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 23, 2024
1 parent b7c6a36 commit ba45b5a
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions mne/tests/test_epochs.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,15 +570,15 @@ def my_reject_1(epoch_data):

def my_reject_2(epoch_data):
bad_idxs = np.where(np.percentile(epoch_data, 90, axis=1) > 1e-35)
reasons = 'a' * len(bad_idxs[0])
reasons = "a" * len(bad_idxs[0])
return len(bad_idxs), reasons

bad_types = [my_reject_1, my_reject_2, ("Hi" "Hi"), (1, 1), None]
for val in bad_types: # protect against bad types
for kwarg in ("reject", "flat"):
with pytest.raises(
TypeError,
match=r".* must be an instance of .* got <class '.*'> instead."
match=r".* must be an instance of .* got <class '.*'> instead.",
):
Epochs(
raw,
Expand Down Expand Up @@ -3282,24 +3282,14 @@ def test_drop_epochs():
events1 = events[events[:, 2] == event_id]

# Bound checks
with pytest.raises(
IndexError,
match=r"Epoch index .* is out of bounds"
):
with pytest.raises(IndexError, match=r"Epoch index .* is out of bounds"):
epochs.drop([len(epochs.events)])
with pytest.raises(
IndexError,
match=r"Epoch index .* is out of bounds"
):
with pytest.raises(IndexError, match=r"Epoch index .* is out of bounds"):
epochs.drop([-len(epochs.events) - 1])
with pytest.raises(
TypeError,
match="indices must be a scalar or a 1-d array"
):
with pytest.raises(TypeError, match="indices must be a scalar or a 1-d array"):
epochs.drop([[1, 2], [3, 4]])
with pytest.raises(
TypeError,
match=r".* must be an instance of .* got <class '.*'> instead."
TypeError, match=r".* must be an instance of .* got <class '.*'> instead."
):
epochs.drop([1], reason=("a", "b", 2))

Expand Down

0 comments on commit ba45b5a

Please sign in to comment.