Skip to content

Commit

Permalink
Use match in pytest.raises
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrltz committed Aug 9, 2024
1 parent 2b825ac commit 5c3aa9a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,10 @@ def test_get_sfreq():


def test_get_sfreq_too_few_timepoints_raises():
with pytest.raises(ValueError) as excinfo:
with pytest.raises(ValueError, match='must contain at least two points'):
get_sfreq(np.array([0]))
assert "must contain at least two points" in str(excinfo.value)


def test_get_sfreq_unequal_spacing_raises():
with pytest.raises(ValueError) as excinfo:
with pytest.raises(ValueError, match='not uniformly spaced')
get_sfreq(np.array([0, 0.01, 0.1]))
assert "not uniformly spaced" in str(excinfo.value)

0 comments on commit 5c3aa9a

Please sign in to comment.