changeset 851:40f3abc3c59d

new tests for case find/lookup + modification + added missing 'r' in front of regexes strings
author Alain Mazy <am@orthanc.team>
date Tue, 09 Sep 2025 15:39:04 +0200
parents 895215bfb8aa
children f53ceeaa9856
files README Tests/Tests.py
diffstat 2 files changed, 148 insertions(+), 50 deletions(-) [+]
line wrap: on
line diff
--- a/README	Tue Aug 12 17:56:46 2025 +0200
+++ b/README	Tue Sep 09 15:39:04 2025 +0200
@@ -125,12 +125,12 @@
 
 # python ./Tests/Run.py
 
-To run a single test with by fixing the Orthanc 0.8.6 executable path:
-# python2 ./Tests/Run.py --force --orthanc /home/alain/Releases/Orthanc-0.8.6/Build/Orthanc Orthanc.test_peer_store_straight
+To run a single test with by fixing the Orthanc 1.12.5 executable path:
+# python2.7 ./Tests/Run.py --force --orthanc /home/alain/Releases/Orthanc-1.12.5 Orthanc.test_peer_store_straight
 
-To run a plugin test (no need for Orthanc 0.8.6)
-# python2 ./Plugins/DicomWeb/Run.py --force
-# python2 ./Plugins/DicomWeb/Run.py --force Orthanc.test_forwarded_headers
+To run a plugin test (no need for another Orthanc)
+# python ./Plugins/DicomWeb/Run.py --force
+# python ./Plugins/DicomWeb/Run.py --force Orthanc.test_forwarded_headers
 
 Use the flag "--help" to get the full list of arguments. These
 arguments will notably allow you to specify the network parameters
--- a/Tests/Tests.py	Tue Aug 12 17:56:46 2025 +0200
+++ b/Tests/Tests.py	Tue Sep 09 15:39:04 2025 +0200
@@ -1027,6 +1027,78 @@
                 self.assertNotEqual('Jodogne', DoGet(_REMOTE, '/instances/%s/content/0010-0010' % j).strip())
 
 
+    def change_patient_id_case_in_patient_keep_source_false(self):
+        UploadInstance(_REMOTE, 'Brainix/Flair/IM-0001-0001.dcm')
+
+        # original PatientID is 5Yp0E, only change the casing of one letter
+        originPatient = DoGet(_REMOTE, '/patients')[0]
+        newPatient = DoPost(_REMOTE, '/patients/%s/modify' % originPatient,
+                            json.dumps({
+                                "Replace": { "PatientID": "5YP0E"},
+                                "Keep": ["StudyInstanceUID", "SeriesInstanceUID", "SOPInstanceUID"],
+                                "Force": True, 
+                                "KeepSource": False
+                            }), 'application/json')['ID']
+
+        self.assertNotEqual(originPatient, newPatient)
+        allStudies = DoGet(_REMOTE, '/studies?expand')
+        self.assertEqual(1, len(allStudies))
+        self.assertEqual('5YP0E', allStudies[0]['PatientMainDicomTags']['PatientID'])
+
+
+    def change_patient_id_case_in_patient_keep_source_true(self):
+        UploadInstance(_REMOTE, 'Brainix/Flair/IM-0001-0001.dcm')
+
+        # original PatientID is 5Yp0E, only change the casing of one letter
+        originPatient = DoGet(_REMOTE, '/patients')[0]
+        newPatient = DoPost(_REMOTE, '/patients/%s/modify' % originPatient,
+                            json.dumps({
+                                "Replace": { "PatientID": "5YP0E"},
+                                "Keep": ["StudyInstanceUID", "SeriesInstanceUID", "SOPInstanceUID"],
+                                "Force": True, 
+                                "KeepSource": True
+                            }), 'application/json')['ID']
+
+        self.assertNotEqual(originPatient, newPatient)
+        self.assertEqual(2, len(DoGet(_REMOTE, '/studies')))
+
+
+    def change_patient_id_case_in_study_keep_source_false(self):
+        UploadInstance(_REMOTE, 'Brainix/Flair/IM-0001-0001.dcm')
+
+        # original PatientID is 5Yp0E, only change the casing of one letter
+        originStudy = DoGet(_REMOTE, '/studies')[0]
+        newStudy = DoPost(_REMOTE, '/studies/%s/modify' % originStudy,
+                            json.dumps({
+                                "Replace": { "PatientID": "5YP0E"},
+                                "Keep": ["StudyInstanceUID", "SeriesInstanceUID", "SOPInstanceUID"],
+                                "Force": True, 
+                                "KeepSource": False
+                            }), 'application/json')['ID']
+
+        self.assertNotEqual(originStudy, newStudy)
+        allStudies = DoGet(_REMOTE, '/studies?expand')
+        self.assertEqual(1, len(allStudies))
+        self.assertEqual('5YP0E', allStudies[0]['PatientMainDicomTags']['PatientID'])
+
+
+    def change_patient_id_case_in_study_keep_source_true(self):
+        UploadInstance(_REMOTE, 'Brainix/Flair/IM-0001-0001.dcm')
+
+        # original PatientID is 5Yp0E, only change the casing of one letter
+        originStudy = DoGet(_REMOTE, '/studies')[0]
+        newStudy = DoPost(_REMOTE, '/studies/%s/modify' % originStudy,
+                            json.dumps({
+                                "Replace": { "PatientID": "5YP0E"},
+                                "Keep": ["StudyInstanceUID", "SeriesInstanceUID", "SOPInstanceUID"],
+                                "Force": True, 
+                                "KeepSource": True
+                            }), 'application/json')['ID']
+
+        self.assertNotEqual(originStudy, newStudy)
+        self.assertEqual(2, len(DoGet(_REMOTE, '/studies')))
+
+
     def test_anonymize_series(self):
         # Upload 4 images from the same series
         for i in range(4):
@@ -1665,56 +1737,56 @@
         UploadInstance(_REMOTE, 'ColorTestImageJ.dcm')
 
         i = CallFindScu([ '-k', '0008,0052=PATIENT', '-k', '0010,0010' ])
-        patientNames = re.findall('\(0010,0010\).*?\[(.*?)\]', i)
+        patientNames = re.findall(r'\(0010,0010\).*?\[(.*?)\]', i)
         self.assertEqual(2, len(patientNames))
         self.assertTrue('Test Patient BG ' in patientNames)
         self.assertTrue('Anonymized' in patientNames)
 
         i = CallFindScu([ '-k', '0008,0052=PATIENT', '-k', '0010,0010=*' ])
-        patientNames = re.findall('\(0010,0010\).*?\[(.*?)\]', i)
+        patientNames = re.findall(r'\(0010,0010\).*?\[(.*?)\]', i)
         self.assertEqual(2, len(patientNames))
         self.assertTrue('Test Patient BG ' in patientNames)
         self.assertTrue('Anonymized' in patientNames)
 
         i = CallFindScu([ '-k', '0008,0052=SERIES', '-k', '0008,0021' ])
-        series = re.findall('\(0008,0021\).*?\[\s*(.*?)\s*\]', i)
+        series = re.findall(r'\(0008,0021\).*?\[\s*(.*?)\s*\]', i)
         self.assertEqual(2, len(series))
         self.assertTrue('20070208' in series)
         self.assertTrue('19980312' in series)
         
         i = CallFindScu([ '-k', '0008,0052=SERIES', '-k', '0008,0021', '-k', 'Modality=MR\\XA' ])
-        series = re.findall('\(0008,0021\).*?\[\s*(.*?)\s*\]', i)
+        series = re.findall(r'\(0008,0021\).*?\[\s*(.*?)\s*\]', i)
         self.assertEqual(1, len(series))
         self.assertTrue('19980312' in series)
         
         i = CallFindScu([ '-k', '0008,0052=SERIES', '-k', 'PatientName=Anonymized' ])
-        series = re.findall('\(0010,0010\).*?\[\s*(.*?)\s*\]', i)
+        series = re.findall(r'\(0010,0010\).*?\[\s*(.*?)\s*\]', i)
         self.assertEqual(1, len(series))
 
         # Test the "CaseSentitivePN" flag (false by default)
         i = CallFindScu([ '-k', '0008,0052=SERIES', '-k', 'PatientName=anonymized' ])
-        series = re.findall('\(0010,0010\).*?\[\s*(.*?)\s*\]', i)
+        series = re.findall(r'\(0010,0010\).*?\[\s*(.*?)\s*\]', i)
         self.assertEqual(1, len(series))
 
         # Test range search (buggy if Orthanc <= 0.9.6)
         i = CallFindScu([ '-k', '0008,0052=STUDY', '-k', 'StudyDate=19980312-' ])
-        studies = re.findall('\(0008,0020\).*?\[\s*(.*?)\s*\]', i)
+        studies = re.findall(r'\(0008,0020\).*?\[\s*(.*?)\s*\]', i)
         self.assertEqual(2, len(studies))
         self.assertTrue('20070208' in studies)
         self.assertTrue('19980312' in studies)
         i = CallFindScu([ '-k', '0008,0052=STUDY', '-k', 'StudyDate=19980312-19980312' ])
-        studies = re.findall('\(0008,0020\).*?\[\s*(.*?)\s*\]', i)
+        studies = re.findall(r'\(0008,0020\).*?\[\s*(.*?)\s*\]', i)
         self.assertEqual(1, len(studies))
         self.assertTrue('19980312' in studies)
         i = CallFindScu([ '-k', '0008,0052=STUDY', '-k', 'StudyDate=-19980312' ])
-        studies = re.findall('\(0008,0020\).*?\[\s*(.*?)\s*\]', i)
+        studies = re.findall(r'\(0008,0020\).*?\[\s*(.*?)\s*\]', i)
         self.assertEqual(1, len(studies))
         self.assertTrue('19980312' in studies)
 
         # Test that "Retrieve AE Title (0008,0054)" is present, which
         # was *not* the case in Orthanc <= 1.7.2
         i = CallFindScu([ '-k', '0008,0052=INSTANCE' ])
-        instances = re.findall('\(0008,0054\).*?\[\s*(.*?)\s*\]', i)
+        instances = re.findall(r'\(0008,0054\).*?\[\s*(.*?)\s*\]', i)
         self.assertEqual(2, len(instances))
         self.assertEqual('ORTHANC', instances[0].strip())
         self.assertEqual('ORTHANC', instances[1].strip())
@@ -1729,14 +1801,14 @@
 
         # Test returning sequence values (only since Orthanc 0.9.5)
         i = CallFindScu([ '-k', '0008,0052=SERIES', '-k', '0008,2112' ])  # "ColorTestImageJ" has this sequence tag
-        sequences = re.findall('\(0008,2112\)', i)
+        sequences = re.findall(r'\(0008,2112\)', i)
         self.assertEqual(1, len(sequences))
 
         # Test returning a non-main DICOM tag,
         # "SecondaryCaptureDeviceID" (0018,1010), whose value is
         # "MEDPC" in "ColorTestImageJ.dcm"
         i = CallFindScu([ '-k', '0008,0052=SERIES', '-k', '0018,1010' ])
-        tags = re.findall('\(0018,1010\).*MEDPC', i)
+        tags = re.findall(r'\(0018,1010\).*MEDPC', i)
         self.assertEqual(1, len(tags))
 
         
@@ -1748,7 +1820,7 @@
         UploadInstance(_REMOTE, 'ColorTestImageJ.dcm')
 
         i = CallFindScu([ '-k', '0008,0052=SERIES', '-k', '0018,1010=MEDPC' ])
-        sequences = re.findall('\(0018,1010\)', i)
+        sequences = re.findall(r'\(0018,1010\)', i)
         self.assertEqual(1, len(sequences))
 
         
@@ -2764,6 +2836,32 @@
         self.assertEqual(0, len(a))
 
 
+    def test_lookup_find_case_sensitivity(self):
+        UploadInstance(_REMOTE, 'DummyCT.dcm')
+
+        a = DoPost(_REMOTE, '/tools/lookup', 'ozp00SjY2xG')
+        self.assertEqual(1, len(a))
+
+        # the lookup is actually case insensitive (because it looks only in the DicomIdentifiers table that contains only uppercase values)
+        a = DoPost(_REMOTE, '/tools/lookup', 'OZP00SjY2xG')
+        self.assertEqual(1, len(a))
+
+        a = DoPost(_REMOTE, '/tools/find', { 'Level' : 'Patient',
+                                             'CaseSensitive' : True,
+                                             'Query' : { 'PatientID' : 'ozp00SjY2xG' }})
+        self.assertEqual(1, len(a))
+
+        a = DoPost(_REMOTE, '/tools/find', { 'Level' : 'Patient',
+                                             'CaseSensitive' : True,
+                                             'Query' : { 'PatientID' : 'OZP00SjY2xG' }})
+        self.assertEqual(0, len(a))
+
+        a = DoPost(_REMOTE, '/tools/find', { 'Level' : 'Patient',
+                                             'CaseSensitive' : False,
+                                             'Query' : { 'PatientID' : 'OZP00SjY2xG' }})
+        self.assertEqual(1, len(a))
+
+
     def test_autorouting(self):
         knee1 = 'Knee/T1/IM-0001-0001.dcm'
         knee2 = 'Knee/T2/IM-0001-0002.dcm'
@@ -3808,45 +3906,45 @@
         UploadInstance(_REMOTE, 'Comunix/Pet/IM-0001-0002.dcm')
 
         i = CallFindScu([ '-k', '0008,0052=PATIENT', '-k', 'NumberOfPatientRelatedStudies' ])
-        s = re.findall('\(0020,1200\).*?\[(.*?)\]', i)
+        s = re.findall(r'\(0020,1200\).*?\[(.*?)\]', i)
         self.assertEqual(1, len(s))
         self.assertTrue('1 ' in s)
 
         i = CallFindScu([ '-k', '0008,0052=PATIENT', '-k', 'NumberOfPatientRelatedSeries' ])
-        s = re.findall('\(0020,1202\).*?\[(.*?)\]', i)
+        s = re.findall(r'\(0020,1202\).*?\[(.*?)\]', i)
         self.assertEqual(1, len(s))
         self.assertTrue('2 ' in s)
 
         i = CallFindScu([ '-k', '0008,0052=PATIENT', '-k', 'NumberOfPatientRelatedInstances' ])
-        s = re.findall('\(0020,1204\).*?\[(.*?)\]', i)
+        s = re.findall(r'\(0020,1204\).*?\[(.*?)\]', i)
         self.assertEqual(1, len(s))
         self.assertTrue('3 ' in s)
 
         i = CallFindScu([ '-k', '0008,0052=STUDY', '-k', 'NumberOfStudyRelatedSeries' ])
-        s = re.findall('\(0020,1206\).*?\[(.*?)\]', i)
+        s = re.findall(r'\(0020,1206\).*?\[(.*?)\]', i)
         self.assertEqual(1, len(s))
         self.assertTrue('2 ' in s)
 
         i = CallFindScu([ '-k', '0008,0052=STUDY', '-k', 'NumberOfStudyRelatedInstances' ])
-        s = re.findall('\(0020,1208\).*?\[(.*?)\]', i)
+        s = re.findall(r'\(0020,1208\).*?\[(.*?)\]', i)
         self.assertEqual(1, len(s))
         self.assertTrue('3 ' in s)
 
         i = CallFindScu([ '-k', '0008,0052=SERIES', '-k', 'NumberOfSeriesRelatedInstances' ])
-        s = re.findall('\(0020,1209\).*?\[(.*?)\]', i)
+        s = re.findall(r'\(0020,1209\).*?\[(.*?)\]', i)
         self.assertEqual(2, len(s))
         self.assertTrue('1 ' in s)
         self.assertTrue('2 ' in s)
 
         i = CallFindScu([ '-k', '0008,0052=STUDY', '-k', 'ModalitiesInStudy' ])
-        s = re.findall('\(0008,0061\).*?\[(.*?)\]', i)
+        s = re.findall(r'\(0008,0061\).*?\[(.*?)\]', i)
         self.assertEqual(1, len(s))
         t = map(lambda x: x.strip(), s[0].split('\\'))
         self.assertTrue('PT' in t)
         self.assertTrue('CT' in t)
 
         i = CallFindScu([ '-k', '0008,0052=STUDY', '-k', 'SOPClassesInStudy' ])
-        s = re.findall('\(0008,0062\).*?\[(.*?)\]', i)
+        s = re.findall(r'\(0008,0062\).*?\[(.*?)\]', i)
         self.assertEqual(1, len(s))
         t = map(lambda x: x.strip('\x00'), s[0].split('\\'))
         self.assertTrue('1.2.840.10008.5.1.4.1.1.2' in t)
@@ -4247,11 +4345,11 @@
                               '-k', 'SpecificCharacterSet',  
                               '-k', 'PatientName' ])
 
-            characterSet = re.findall('\(0008,0005\).*?\[(.*?)\]', i)
+            characterSet = re.findall(r'\(0008,0005\).*?\[(.*?)\]', i)
             self.assertEqual(1, len(characterSet))
             self.assertEqual(ENCODINGS[name][0], characterSet[0].strip())
 
-            patientName = re.findall('\(0010,0010\).*?\[(.*?)\]', i)
+            patientName = re.findall(r'\(0010,0010\).*?\[(.*?)\]', i)
             self.assertEqual(1, len(patientName))
 
             expected = TEST.encode(ENCODINGS[name][1], 'ignore')
@@ -4273,15 +4371,15 @@
                                   '-k', 'PatientName' ])
                 i = i.decode(ENCODINGS[master][1])
 
-                characterSet = re.findall('\(0008,0005\).*?\[(.*?)\]', i)
+                characterSet = re.findall(r'\(0008,0005\).*?\[(.*?)\]', i)
                 self.assertEqual(1, len(characterSet))
                 self.assertEqual(ENCODINGS[master][0], characterSet[0].strip())
 
-                patientId = re.findall('\(0010,0020\).*?\[(.*?)\]', i)
+                patientId = re.findall(r'\(0010,0020\).*?\[(.*?)\]', i)
                 self.assertEqual(1, len(patientId))
                 self.assertEqual(ENCODINGS[name][1], patientId[0].strip())
 
-                patientName = re.findall('\(0010,0010\).*?\[(.*?)\]', i)
+                patientName = re.findall(r'\(0010,0010\).*?\[(.*?)\]', i)
                 self.assertEqual(1, len(patientName))
 
                 tmp = ENCODINGS[name][1]
@@ -4708,7 +4806,7 @@
             a = CallFindScu([ '-k', '0008,0005=ISO_IR 192',  # Use UTF-8
                               '-k', '0008,0052=PATIENT',
                               '-k', 'PatientName=%s' % name ])
-            patientNames = re.findall('\(0010,0010\).*?\[(.*?)\]', a)
+            patientNames = re.findall(r'\(0010,0010\).*?\[(.*?)\]', a)
             self.assertEqual(expected, len(patientNames))
 
             a = DoPost(_REMOTE, '/tools/find', { 'Level' : 'Patient',
@@ -5588,13 +5686,13 @@
     def test_invalid_findscp(self):
         UploadInstance(_REMOTE, 'DummyCT.dcm')
         findscu = CallFindScu([ '-S', '-k', '8,52=IMAGE', '-k', '8,16', '-k', '2,2' ])
-        self.assertEqual(0, len(re.findall('\(0002,0002\)', findscu)))
+        self.assertEqual(0, len(re.findall(r'\(0002,0002\)', findscu)))
 
 
     def test_bitbucket_issue_90(self):
         def CountDicomResults(sex):
             a = CallFindScu([ '-S', '-k', '8,52=STUDY', '-k', sex ])
-            return len(re.findall('\(0010,0040\)', a))
+            return len(re.findall(r'\(0010,0040\)', a))
 
         def CountRestResults(sex):
             a = DoPost(_REMOTE, '/tools/find',
@@ -5756,18 +5854,18 @@
         i = CallFindScu([ '-k', '0008,0052=IMAGES', '-k', 'PatientName', '-k', 'Rows', '-k', 'Columns' ])
 
         # We have 2 instances...
-        patientNames = re.findall('\(0010,0010\).*?\[(.*?)\]', i)
+        patientNames = re.findall(r'\(0010,0010\).*?\[(.*?)\]', i)
         self.assertEqual(2, len(patientNames))
         self.assertEqual('KNIX', patientNames[0])
         self.assertEqual('KNIX', patientNames[1])
 
-        columns = re.findall('\(0028,0011\) US ([0-9]+)', i)
+        columns = re.findall(r'\(0028,0011\) US ([0-9]+)', i)
         self.assertEqual(2, len(columns))
         self.assertEqual('512', columns[0])
         self.assertEqual('512', columns[1])
         
         # ...but only 1 value for the "Rows" tag
-        rows = re.findall('\(0028,0010\) US ([0-9]+)', i)
+        rows = re.findall(r'\(0028,0010\) US ([0-9]+)', i)
         self.assertEqual(1, len(rows))
         self.assertEqual('512', rows[0])
 
@@ -5847,7 +5945,7 @@
     def test_bitbucket_issue_136(self):
         UploadInstance(_REMOTE, 'Issue137.dcm')
         i = CallFindScu([ '-k', '0008,0052=STUDY', '-k', '0010,0010', '-k', '0028,0010', '-k', '0040,0275' ])
-        patientNames = re.findall('\(0010,0010\).*?\[(.*?)\]', i)
+        patientNames = re.findall(r'\(0010,0010\).*?\[(.*?)\]', i)
         self.assertEqual(1, len(patientNames))
         self.assertEqual('John Doe', patientNames[0])
 
@@ -6492,7 +6590,7 @@
         i = CallFindScu([ '-k', 'QueryRetrieveLevel=SERIES',
                           '-k', 'StudyInstanceUID=%s' % study,
                           '-k', 'SeriesInstanceUID=%s\\%s' % (series1, series2) ])
-        series = re.findall('\(0020,000e\).*?\[(.*?)\]', i)
+        series = re.findall(r'\(0020,000e\).*?\[(.*?)\]', i)
         self.assertEqual(2, len(series))
         self.assertTrue(series1 in series)
         self.assertTrue(series2 in series)
@@ -7539,14 +7637,14 @@
         study = '1.3.46.670589.7.5.8.80001255161.20000323.151537.1'
         
         i = CallFindScu([ '-k', '0008,0052=STUDY', '-k', 'StudyInstanceUID' ])
-        result = re.findall('\(0020,000d\).*?\[(.*?)\]', i)
+        result = re.findall(r'\(0020,000d\).*?\[(.*?)\]', i)
         self.assertEqual(2, len(result))
 
         # The "StudyInstanceUID" is set as a list of 5 times the same
         # study, leading to a string of 249 characters
         i = CallFindScu([ '-k', '0008,0052=STUDY', '-k',
                           'StudyInstanceUID=%s\\%s\\%s\\%s\\%s' % (( study, ) * 5) ])
-        result = re.findall('\(0020,000d\).*?\[(.*?)\]', i)
+        result = re.findall(r'\(0020,000d\).*?\[(.*?)\]', i)
         self.assertEqual(1, len(result))
         
         # The "StudyInstanceUID" is set as a list of 6 times the same
@@ -7558,7 +7656,7 @@
         # studies (i.e. 2). This issue was fixed in Orthanc 1.7.3.
         i = CallFindScu([ '-k', '0008,0052=STUDY', '-k',
                           'StudyInstanceUID=%s\\%s\\%s\\%s\\%s\\%s' % (( study, ) * 6) ])
-        result = re.findall('\(0020,000d\).*?\[(.*?)\]', i)
+        result = re.findall(r'\(0020,000d\).*?\[(.*?)\]', i)
         self.assertEqual(1, len(result))
 
 
@@ -7690,7 +7788,7 @@
         UploadInstance(_REMOTE, 'Comunix/Pet/IM-0001-0001.dcm')
 
         i = CallFindScu([ '-k', '0008,0052=STUDY', '-k', '0020,000d=', '-k', '0008,0061=' ])
-        modalitiesInStudy = re.findall('\(0008,0061\).*?\[(.*?)\]', i)
+        modalitiesInStudy = re.findall(r'\(0008,0061\).*?\[(.*?)\]', i)
         self.assertEqual(1, len(modalitiesInStudy))
         self.assertEqual('CT\\PT ', modalitiesInStudy[0])
         
@@ -7708,7 +7806,7 @@
             self.assertEqual(expected, len(a))
 
             i = CallFindScu([ '-k', '0008,0052=STUDY', '-k', '0020,000d=', '-k', '0008,0061=%s' % i ])
-            studyInstanceUid = re.findall('\(0020,000d\).*?\[(.*?)\]', i)
+            studyInstanceUid = re.findall(r'\(0020,000d\).*?\[(.*?)\]', i)
             self.assertEqual(expected, len(studyInstanceUid))
         
 
@@ -10755,7 +10853,7 @@
 
         i = CallFindScu([ '-k', '0008,0052=PATIENT', '-k', '0008,0000=22' ])  # GE like C-Find that includes group-length
         # print(i)
-        s = re.findall('\(0008,0000\).*?\[(.*?)\]', i)
+        s = re.findall(r'\(0008,0000\).*?\[(.*?)\]', i)
         self.assertEqual(0, len(s))
 
 
@@ -11115,20 +11213,20 @@
 
         # without requesting PatientComments, we get the computed tags
         i = CallFindScu([ '-k', 'PatientID=WITH_COMMENTS',  '-k', 'QueryRetrieveLevel=Study', '-k', 'ModalitiesInStudy', '-k', 'NumberOfStudyRelatedSeries', '-k', 'NumberOfStudyRelatedInstances' ])
-        modalitiesInStudy = re.findall('\(0008,0061\).*?\[(.*?)\]', i)
+        modalitiesInStudy = re.findall(r'\(0008,0061\).*?\[(.*?)\]', i)
         self.assertEqual(1, len(modalitiesInStudy))
         self.assertEqual('CT', modalitiesInStudy[0])
 
         if IsOrthancVersionAbove(_REMOTE, 1, 12, 5):
             # when requesting PatientComments, with 1.12.4, we did not get the computed tags
             i = CallFindScu([ '-k', 'PatientID=WITH_COMMENTS',  '-k', 'QueryRetrieveLevel=Study', '-k', 'ModalitiesInStudy', '-k', 'NumberOfStudyRelatedSeries', '-k', 'NumberOfStudyRelatedInstances', '-k', 'PatientComments' ])
-            modalitiesInStudy = re.findall('\(0008,0061\).*?\[(.*?)\]', i)
+            modalitiesInStudy = re.findall(r'\(0008,0061\).*?\[(.*?)\]', i)
             self.assertEqual(1, len(modalitiesInStudy))
             self.assertEqual('CT', modalitiesInStudy[0])
-            numberOfStudyRelatedSeries = re.findall('\(0020,1206\).*?\[(.*?)\]', i)
+            numberOfStudyRelatedSeries = re.findall(r'\(0020,1206\).*?\[(.*?)\]', i)
             self.assertEqual(1, len(numberOfStudyRelatedSeries))
             self.assertEqual(1, int(numberOfStudyRelatedSeries[0]))
-            numberOfStudyRelatedInstances = re.findall('\(0020,1208\).*?\[(.*?)\]', i)
+            numberOfStudyRelatedInstances = re.findall(r'\(0020,1208\).*?\[(.*?)\]', i)
             self.assertEqual(1, len(numberOfStudyRelatedInstances))
             self.assertEqual(1, int(numberOfStudyRelatedInstances[0]))
 
@@ -12151,7 +12249,7 @@
             # from https://discourse.orthanc-server.org/t/issue-with-special-characters-when-scans-where-uploaded-with-specificcharacterset-dicom-tag-value-as-iso-ir-13/5962
             instanceId = UploadInstance(_REMOTE, 'Encodings/ISO_IR13.dcm')['ID']
             tags = DoGet(_REMOTE, '/instances/%s/tags?simplify' % instanceId)
-            self.assertEqual('ORIGINAL\PRIMARY\M\NORM\DIS2D\FM\FIL', tags['ImageType'])
+            self.assertEqual(r'ORIGINAL\PRIMARY\M\NORM\DIS2D\FM\FIL', tags['ImageType'])
 
 
     def test_jobs_user_data(self):