Skip to content

Commit

Permalink
Update test_fiff.py
Browse files Browse the repository at this point in the history
  • Loading branch information
vferat committed Mar 1, 2025
1 parent e3bca97 commit ab301e2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pycrostates/io/tests/test_fiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,28 +290,28 @@ def test_prepare_kwargs():
_prepare_kwargs("ModKMeans", kwargs)

# remove one value
kwargs = dict(max_iter=ModK._max_iter, tol=ModK._tol, GEV_=ModK._GEV_)
kwargs = dict(max_iter=ModK._max_iter, tol=ModK._tol, GEV_=ModK._GEV_, ignore_polarity=False)
with pytest.raises(ValueError, match="Wrong kwargs provided for"):
_prepare_kwargs("ModKMeans", kwargs)


def test_prepare_kwargs_ModKMeans():
"""Test invalid key/values for ModKMeans."""
kwargs = dict(n_init=-101, max_iter=ModK._max_iter, tol=ModK._tol, GEV_=ModK._GEV_)
kwargs = dict(n_init=-101, max_iter=ModK._max_iter, tol=ModK._tol, GEV_=ModK._GEV_, ignore_polarity=False)
with pytest.raises(ValueError, match="initialization must be a positive integer"):
_prepare_kwargs("ModKMeans", kwargs)

kwargs = dict(n_init=ModK._n_init, max_iter=-101, tol=ModK._tol, GEV_=ModK._GEV_)
kwargs = dict(n_init=ModK._n_init, max_iter=-101, tol=ModK._tol, GEV_=ModK._GEV_, ignore_polarity=False)
with pytest.raises(ValueError, match="max iteration must be a positive"):
_prepare_kwargs("ModKMeans", kwargs)

kwargs = dict(
n_init=ModK._n_init, max_iter=ModK.max_iter, tol=-101, GEV_=ModK._GEV_
)
with pytest.raises(ValueError, match="tolerance must be a positive number"):
with pytest.raises(ValueError, match="tolerance must be a positive number", ignore_polarity=False):
_prepare_kwargs("ModKMeans", kwargs)

kwargs = dict(n_init=ModK.n_init, max_iter=ModK.max_iter, tol=ModK.tol, GEV_=101)
kwargs = dict(n_init=ModK.n_init, max_iter=ModK.max_iter, tol=ModK.tol, GEV_=101, ignore_polarity=False)
with pytest.raises(
ValueError, match="'GEV_' should be a percentage between 0 and 1"
):
Expand Down

0 comments on commit ab301e2

Please sign in to comment.