@@ -92,6 +92,30 @@ def test_probegroup_allows_duplicate_positions_across_probes():
9292 assert len (group .probes ) == 2
9393
9494
95+ def test_set_contact_ids_rejects_within_probe_duplicates ():
96+ """Setting duplicate contact_ids within a single probe raises ValueError."""
97+ from probeinterface import Probe
98+
99+ positions = np .array ([[0 , 0 ], [10 , 10 ]])
100+ probe = Probe (ndim = 2 , si_units = "um" )
101+ probe .set_contacts (positions = positions , shapes = "circle" , shape_params = {"radius" : 5 })
102+
103+ with pytest .raises (ValueError , match = "unique within a Probe" ):
104+ probe .set_contact_ids (["a" , "a" ])
105+
106+
107+ def test_set_contact_ids_rejects_wrong_size ():
108+ """Setting contact_ids with wrong count raises ValueError."""
109+ from probeinterface import Probe
110+
111+ positions = np .array ([[0 , 0 ], [10 , 10 ]])
112+ probe = Probe (ndim = 2 , si_units = "um" )
113+ probe .set_contacts (positions = positions , shapes = "circle" , shape_params = {"radius" : 5 })
114+
115+ with pytest .raises (ValueError , match = "do not have the same size" ):
116+ probe .set_contact_ids (["a" , "b" , "c" ])
117+
118+
95119if __name__ == "__main__" :
96120 test_probegroup ()
97121 # ~ test_probegroup_3d()
0 commit comments