@@ -675,6 +675,49 @@ def test_add_probe_default_id_with_non_numeric_ids():
675675 assert pg .probe_ids == ["left" , "right" , "0" ]
676676
677677
678+ def test_select_contacts_ambiguous_id_message_points_to_probe_ids ():
679+ """
680+ When a contact id exists on several probes and no probe_ids are given, the
681+ error must guide the user to pass probe_ids rather than claim it cannot happen.
682+ """
683+ pg = _probegroup_with_contact_ids (unique = False )
684+ expected_error = """Some contact ids are ambiguous because they live on multiple probes; pass probe_ids to disambiguate which probe each belongs to:
685+ "c0" lives on probes ['0', '1', '2']"""
686+ with pytest .raises (ValueError ) as exc_info :
687+ pg .select_contacts (["c0" ])
688+ assert str (exc_info .value ) == expected_error
689+
690+
691+ def test_select_contacts_reports_all_ambiguous_ids_at_once ():
692+ """
693+ When several requested contact ids are ambiguous, the error lists all of them
694+ (with the probes each lives on) rather than failing on the first one.
695+ """
696+ pg = _probegroup_with_contact_ids (unique = False )
697+ expected_error = """Some contact ids are ambiguous because they live on multiple probes; pass probe_ids to disambiguate which probe each belongs to:
698+ "c0" lives on probes ['0', '1', '2']
699+ "c1" lives on probes ['0', '1', '2']"""
700+ with pytest .raises (ValueError ) as exc_info :
701+ pg .select_contacts (["c0" , "c1" ])
702+ assert str (exc_info .value ) == expected_error
703+
704+
705+ def test_get_slice_preserves_planar_contour ():
706+ """
707+ probe_planar_contour is a probe-level attribute (not part of the to_numpy
708+ dtype), so get_slice must copy it over explicitly instead of losing it.
709+ """
710+ pg = ProbeGroup ()
711+ probe = generate_dummy_probe ()
712+ contour = [[- 10 , - 10 ], [- 10 , 100 ], [50 , 120 ], [50 , - 10 ]]
713+ probe .set_planar_contour (contour )
714+ pg .add_probe (probe )
715+
716+ sub = pg .get_slice (np .array ([0 , 1 , 2 ]))
717+ assert sub .probes [0 ].probe_planar_contour is not None
718+ np .testing .assert_array_equal (sub .probes [0 ].probe_planar_contour , contour )
719+
720+
678721if __name__ == "__main__" :
679722 probegroup = _make_probegroup ()
680723
0 commit comments