| Total Complexity | 3 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import os |
||
|
|
|||
| 2 | from oshelper.file_operation import copy_files_to_flat_folder, recursive_list_files |
||
| 3 | |||
| 4 | |||
| 5 | def test_recursive_load(): |
||
| 6 | file_list = recursive_list_files(os.getcwd()) |
||
| 7 | print(file_list) |
||
| 8 | assert len(file_list) > 56 # the current files within the source code |
||
| 9 | |||
| 10 | def test_copy_files_to_flat_folder(): |
||
| 11 | |||
| 12 | from pydicom.data import get_testdata_files |
||
| 13 | file_list = get_testdata_files("*") |
||
| 14 | |||
| 15 | # Local Computer DICOM test. |
||
| 16 | # path1 = r"C:\FullyAnonymizedSubjects\anonymus\brain1" |
||
| 17 | # file_list = recursive_list_files(path1) |
||
| 18 | |||
| 19 | # Output DIR: |
||
| 20 | tmp_folder = os.getcwd() |
||
| 21 | folder_name = "files" |
||
| 22 | folder = os.path.join(tmp_folder, folder_name) |
||
| 23 | |||
| 24 | # Create folder before copying. |
||
| 25 | os.mkdir(folder) |
||
| 26 | copy_files_to_flat_folder(file_list, folder) |
||
| 27 | |||
| 28 | import shutil |
||
| 29 | # Remove that folder now. |
||
| 30 | shutil.rmtree(folder) |
||
| 31 | |||
| 32 | |||
| 33 | if __name__ == '__main__': |
||
| 34 | test_recursive_load() |
||
| 35 | test_copy_files_to_flat_folder() |
||
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.