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

Python.orthanc.test_orthanc.test_deleteSubjects()   A

Complexity

Conditions 4

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 10
rs 10
c 0
b 0
f 0
cc 4
nop 0
1
from pydicom.data import get_testdata_files
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
3
from orthanc.query import getOrthanc, postOrthanc, deleteOrthanc
0 ignored issues
show
introduced by
Unable to import 'orthanc.query'
Loading history...
4
5
from LORIS.helper import is_response_success, check_json
0 ignored issues
show
introduced by
Unable to import 'LORIS.helper'
Loading history...
6
7
8
def uploadExamplesToOrthanc():
0 ignored issues
show
Coding Style Naming introduced by
The name uploadExamplesToOrthanc does not conform to the function naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
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...
9
10
    file_list = get_testdata_files("[Mm][Rr][Ii]")
11
    for file in file_list:
12
        upload = {'upload_file': open(file, 'rb')}
13
        status, r = postOrthanc("instances/", upload)
0 ignored issues
show
Coding Style Naming introduced by
The name r does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
14
        assert(is_response_success(status, 200))
0 ignored issues
show
Unused Code Coding Style introduced by
There is an unnecessary parenthesis after assert.
Loading history...
15
        assert(check_json(r.json()))
0 ignored issues
show
Unused Code Coding Style introduced by
There is an unnecessary parenthesis after assert.
Loading history...
16
17
    # Note that this will create several subjects.
18
19
def test_getSubjects():
0 ignored issues
show
Coding Style Naming introduced by
The name test_getSubjects does not conform to the function naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
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...
20
    uploadExamplesToOrthanc()
21
    reseponse_code, list_subjects = getOrthanc("patients/")
22
    assert (is_response_success(reseponse_code, 200))
0 ignored issues
show
Unused Code Coding Style introduced by
There is an unnecessary parenthesis after assert.
Loading history...
23
24
    print(len(list_subjects))
25
26
27
def test_deleteSubjects():
0 ignored issues
show
Coding Style Naming introduced by
The name test_deleteSubjects does not conform to the function naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
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...
28
    uploadExamplesToOrthanc()
29
    reseponse_code, list_subjects = getOrthanc("patients/")
30
    assert (is_response_success(reseponse_code, 200))
0 ignored issues
show
Unused Code Coding Style introduced by
There is an unnecessary parenthesis after assert.
Loading history...
31
32
    print(len(list_subjects))
33
34
    for subject in list_subjects:
35
        reseponse_code, r = deleteOrthanc("patients/"+subject)
0 ignored issues
show
Coding Style Naming introduced by
The name r does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Unused Code introduced by
The variable r seems to be unused.
Loading history...
36
        assert (is_response_success(reseponse_code, 200))
0 ignored issues
show
Unused Code Coding Style introduced by
There is an unnecessary parenthesis after assert.
Loading history...
37
38
39
if __name__ is "__main__":
0 ignored issues
show
introduced by
Comparison to literal
Loading history...
40
    test_deleteSubjects()
0 ignored issues
show
Coding Style introduced by
Final newline missing
Loading history...