Passed
Push — master ( 9e6838...cf264a )
by Yang
27s
created

Python.oshelper.test_file_ops   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 20
dl 0
loc 36
rs 10
c 0
b 0
f 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A test_recursive_load() 0 4 2
A test_copy_files_to_flat_folder() 0 21 1
1
import os
0 ignored issues
show
Coding Style introduced by
This module should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2
from oshelper.file_operation import copy_files_to_flat_folder, recursive_list_files
0 ignored issues
show
introduced by
Unable to import 'oshelper.file_operation'
Loading history...
3
4
5
def test_recursive_load():
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
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():
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
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()
0 ignored issues
show
Coding Style introduced by
Final newline missing
Loading history...