| Total Complexity | 2 |
| Total Lines | 43 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import sys |
||
|
|
|||
| 2 | import logging |
||
| 3 | import unittest |
||
| 4 | |||
| 5 | from DICOM.validate import DICOM_validate |
||
| 6 | from DICOM.test_DICOM import get_test_DICOM_path |
||
| 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): |
||
| 13 | |||
| 14 | @staticmethod |
||
| 15 | def test_MRN(): |
||
| 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(): |
||
| 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 | |||
| 44 |
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.