| Total Complexity | 3 |
| Total Lines | 26 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import unittest |
||
|
|
|||
| 2 | from tempfile import TemporaryDirectory |
||
| 3 | from DICOM.anonymize import DICOM_anonymize |
||
| 4 | from shutil import copyfile |
||
| 5 | import os |
||
| 6 | |||
| 7 | class UT_DICOMAnonymization(unittest.TestCase): |
||
| 8 | |||
| 9 | @staticmethod |
||
| 10 | def test_folder(): |
||
| 11 | from pydicom.data import get_testdata_files |
||
| 12 | |||
| 13 | # Make Temporary Folder |
||
| 14 | files = get_testdata_files("[mM][rR][iI]") |
||
| 15 | |||
| 16 | # Copy files to Temporary Folder |
||
| 17 | with TemporaryDirectory() as temp_folder: |
||
| 18 | |||
| 19 | # Copy all files |
||
| 20 | for file in files: |
||
| 21 | path, fileName = os.path.split(file) |
||
| 22 | copyfile(file, os.path.join(temp_folder, fileName)) |
||
| 23 | |||
| 24 | # Anonymize that folder. |
||
| 25 | DICOM_anonymize.folder(temp_folder, "NEW_CONTESTANT") |
||
| 26 | |||
| 27 |
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.