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
2 changes: 1 addition & 1 deletion src/probeinterface/probe.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ def set_device_channel_indices(self, channel_indices: np.ndarray | list):
"""
channel_indices = np.asarray(channel_indices, dtype=int)
if channel_indices.size != self.get_contact_count():
ValueError(
raise ValueError(
f"channel_indices {channel_indices.size} do not have "
f"the same size as contacts {self.get_contact_count()}"
)
Expand Down
13 changes: 13 additions & 0 deletions tests/test_probe.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,19 @@ def test_probe():
# ~ plt.show()


def test_set_device_channel_indices_rejects_wrong_size():
"""Setting device_channel_indices with wrong count raises ValueError."""
probe = Probe(ndim=2, si_units="um")
probe.set_contacts(
positions=np.array([[0, 0], [10, 0], [20, 0]]),
shapes="circle",
shape_params={"radius": 5},
)

with pytest.raises(ValueError, match="do not have"):
probe.set_device_channel_indices([0, 1])


def test_probe_equality_dunder():
probe1 = generate_dummy_probe()
probe2 = generate_dummy_probe()
Expand Down
Loading