@@ -421,15 +421,17 @@ def test_find_worklist_items_with_date_and_time_range(self, mock_db, tmp_dir):
421421 )
422422
423423 @pytest .mark .parametrize (
424- "dicom_pattern, sql_pattern" ,
424+ "dicom_pattern, sql_pattern, operator " ,
425425 [
426- ("Smith*" , "Smith%" ), # trailing wildcard
427- ("*Smith*" , "%Smith%" ), # leading and trailing wildcard
428- ("Sm?th*" , "Sm_th%" ), # single-character wildcard combined with trailing
429- ("Smith^Jane" , "Smith^Jane" ), # exact name, no wildcards
426+ ("Smith*" , "Smith%" , "LIKE" ), # trailing wildcard
427+ ("*Smith*" , "%Smith%" , "LIKE" ), # leading and trailing wildcard
428+ ("Sm?th*" , "Sm_th%" , "LIKE" ), # single-character wildcard combined with trailing
429+ ("Smith^Jane" , "Smith^Jane" , "=" ), # exact name, no wildcards — uses = not LIKE
430430 ],
431431 )
432- def test_find_worklist_items_patient_name_wildcard_conversion (self , mock_db , tmp_dir , dicom_pattern , sql_pattern ):
432+ def test_find_worklist_items_patient_name_wildcard_conversion (
433+ self , mock_db , tmp_dir , dicom_pattern , sql_pattern , operator
434+ ):
433435 mock_cursor = MagicMock ()
434436 mock_cursor .fetchall .return_value = []
435437 mock_connection = MagicMock ()
@@ -445,7 +447,7 @@ def test_find_worklist_items_patient_name_wildcard_conversion(self, mock_db, tmp
445447 "SELECT accession_number, modality, patient_birth_date, patient_id, "
446448 "patient_name, patient_sex, procedure_code, scheduled_date, scheduled_time, "
447449 "source_message_id, study_description, study_instance_uid, status, mpps_instance_uid "
448- "FROM worklist_items WHERE UPPER(patient_name) LIKE UPPER(?) ORDER BY scheduled_date, scheduled_time"
450+ f "FROM worklist_items WHERE UPPER(patient_name) { operator } UPPER(?) ORDER BY scheduled_date, scheduled_time"
449451 ),
450452 [sql_pattern ],
451453 )
0 commit comments