Skip to content

Commit

Permalink
Add e2e test
Browse files Browse the repository at this point in the history
- Check valid relationships between a functional group macro attribute and JSON table files
- Issue #21
  • Loading branch information
russellkan committed May 8, 2020
1 parent 815793e commit 453a9a9
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions tests/end_to_end_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import subprocess
from collections import Counter
from operator import itemgetter

import pytest

Expand Down Expand Up @@ -139,6 +140,53 @@ def test_vertical_samples_from_standard(ciods, modules, attributes):
assert all(attr in attributes for attr in test_attributes)


@pytest.mark.endtoend
def test_trace_from_ciod_to_func_group_attribute(ciod_fg_macro_relationship, ciods, macros,
macro_attribute_relationship, modules,
module_attribute_relationship, attributes):
ciod_macro = {
"ciodId":"enhanced-mr-image",
"macroId":"referenced-image",
"usage":"C",
"conditionalStatement":"Required if the image or frame has been planned on another image or frame. May be present otherwise"
}
macro_attr = {
"macroId":"referenced-image",
"path":"referenced-image:00081140:00081150",
"tag":"(0008,1150)",
"type":"1",
"linkToStandard":"http://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_C.7.6.16.2.5.html#table_C.7.6.16-6",
"description":"<td colspan=\"1\" rowspan=\"1\">\n<p>\nUniquely identifies the referenced SOP Class.</p>\n</td>",
"externalReferences":[]
}
ciod_specific_module_id = f'{ciod_macro["ciodId"]}-multi-frame-functional-groups'
module_attr = {
"moduleId":"enhanced-mr-image-multi-frame-functional-groups",
"path":"enhanced-mr-image-multi-frame-functional-groups:52009230:00081140:00081150",
"tag":"(0008,1150)",
"type":"1",
"linkToStandard":"http://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_C.7.6.16.2.5.html#table_C.7.6.16-6",
"description":"<td colspan=\"1\" rowspan=\"1\">\n<p>\nUniquely identifies the referenced SOP Class.</p>\n</td><h3>Note</h3><p>Part of the Referenced Image Functional Group Macro with usage: C</p><p>Required if the image or frame has been planned on another image or frame. May be present otherwise.</p>",
"externalReferences":[]
}
attr = {
"tag":"(0008,1150)",
"name":"Referenced SOP Class UID",
"keyword":"ReferencedSOPClassUID",
"valueRepresentation":"UI",
"valueMultiplicity":"1",
"retired":"N",
"id":"00081150"
}
assert ciod_macro in ciod_fg_macro_relationship
assert ciod_macro['ciodId'] in map(itemgetter('id'), ciods)
assert ciod_macro['macroId'] in map(itemgetter('id'), macros)
assert macro_attr in macro_attribute_relationship
assert ciod_specific_module_id in map(itemgetter('id'), modules)
assert module_attr in module_attribute_relationship
assert attr in attributes


@pytest.mark.endtoend
def test_trace_from_attribute_to_ciod(ciods, ciod_module_relationship, modules,
module_attribute_relationship, attributes):
Expand Down

0 comments on commit 453a9a9

Please sign in to comment.