Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/hssm/data_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,16 @@ def _post_check_data_sanity(self):

if np.any(~np.isin(unique_responses, self.choices)):
invalid_responses = sorted(
unique_responses[~np.isin(unique_responses, self.choices)]
unique_responses[~np.isin(unique_responses, self.choices)].tolist()
)
raise ValueError(
f"Invalid responses found in your dataset: {invalid_responses}"
)

if len(unique_responses) != self.n_choices:
missing_responses = sorted(np.setdiff1d(self.choices, unique_responses))
missing_responses = sorted(
np.setdiff1d(self.choices, unique_responses).tolist()
)
warnings.warn(
(
f"You set choices to be {self.choices}, but {missing_responses} "
Expand Down
2 changes: 1 addition & 1 deletion src/hssm/prior.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


# mypy: disable-error-code="has-type"
class Prior(bmb.Prior):
class Prior(bmb.Prior): # noqa: PLW1641
"""Abstract specification of a prior.

Parameters
Expand Down
4 changes: 2 additions & 2 deletions tests/param/test_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

def test_bounds_validation():
"""Test that the bounds are validated correctly."""
with pytest.raises(ValueError, match="Invalid bounds: \(0, 0, 1\)"):
with pytest.raises(ValueError, match=r"Invalid bounds: \(0, 0, 1\)"):
Param(name="test", prior=0, bounds=(0, 0, 1))
with pytest.raises(ValueError, match="Invalid bounds: \(1, 0\)"):
with pytest.raises(ValueError, match=r"Invalid bounds: \(1, 0\)"):
Param(name="test", prior=0, bounds=(1, 0))


Expand Down
4 changes: 2 additions & 2 deletions tests/param/test_user_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

def test_bounds_validation():
"""Test that the bounds are validated correctly."""
with pytest.raises(ValueError, match="Invalid bounds: \(0, 0, 1\)"):
with pytest.raises(ValueError, match=r"Invalid bounds: \(0, 0, 1\)"):
UserParam(name="test", prior=0, bounds=(0, 0, 1))
with pytest.raises(ValueError, match="Invalid bounds: \(1, 0\)"):
with pytest.raises(ValueError, match=r"Invalid bounds: \(1, 0\)"):
UserParam(name="test", prior=0, bounds=(1, 0))


Expand Down