Completed
Pull Request — master (#3)
by Yang
04:29
created

Python.DICOM.test_validate   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 31
dl 0
loc 43
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A UT_DICOMValidation.test_MRN() 0 19 1
A UT_DICOMValidation.test_DICOM_validator() 0 9 1
1
import sys
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
import logging
3
import unittest
4
5
from DICOM.validate import DICOM_validate
0 ignored issues
show
introduced by
Unable to import 'DICOM.validate'
Loading history...
6
from DICOM.test_DICOM import get_test_DICOM_path
0 ignored issues
show
introduced by
Unable to import 'DICOM.test_DICOM'
Loading history...
7
from pydicom.data import get_testdata_files
8
9
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
10
11
12
class UT_DICOMValidation(unittest.TestCase):
0 ignored issues
show
Coding Style Naming introduced by
The name UT_DICOMValidation does not conform to the class naming conventions ([A-Z_][a-zA-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 class 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...
Unused Code introduced by
The variable __class__ seems to be unused.
Loading history...
13
14
    @staticmethod
15
    def test_MRN():
0 ignored issues
show
Coding Style Naming introduced by
The name test_MRN does not conform to the method 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 method 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...
16
        string = 1234567
17
        assert DICOM_validate.MRN(string)
18
19
        string = "1234567"
20
        assert DICOM_validate.MRN(string)
21
22
        string = "12345678"
23
        assert not DICOM_validate.MRN(string)
24
25
        string = 12345678
26
        assert not DICOM_validate.MRN(string)
27
28
        string = "123456"
29
        assert DICOM_validate.MRN(string)
30
31
        string = 123456
32
        assert DICOM_validate.MRN(string)
33
34
    @staticmethod
35
    def test_DICOM_validator():
0 ignored issues
show
Coding Style Naming introduced by
The name test_DICOM_validator does not conform to the method 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 method 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...
36
        file_name = get_test_DICOM_path()
37
        success, _ = DICOM_validate.file(file_name)
38
        assert success
39
40
        file_name = get_testdata_files("README.txt")[0]
41
        success, _ = DICOM_validate.file(file_name)
42
        assert not success
43
0 ignored issues
show
coding-style introduced by
Trailing newlines
Loading history...
44