small test to accompany the check via recursive descent in to sequences of
is_anonymised_dataset() in _dicom.anonymise
just incorporates a single item in a sequence, OverrideSequence,
where the sequence item contains a single identifying element, OperatorsName
@@ -30,6 +30,7 @@ from pymedphys._dicom.anonymise import (
label_dicom_filepath_as_anonymised,
)
from pymedphys._dicom.constants import get_baseline_dicom_dict
+from pymedphys._dicom.create import dicom_dataset_from_dict
from pymedphys._dicom.utilities import remove_file
from pymedphys.dicom import anonymise as anonymise_dataset
@@ -111,6 +112,15 @@ def _get_non_anonymous_replacement_value(keyword):
return VR_NON_ANONYMOUS_REPLACEMENT_VALUE_DICT[vr]
+@pytest.mark.pydicom
+def test_anonymised_dataset_with_nested_name():
+ nested_name = dicom_dataset_from_dict(
+ {"OverrideSequence": [{"OperatorsName": "George"}]}
+ )
+
+ assert not is_anonymised_dataset(nested_name)
+
+
@pytest.mark.slow
@pytest.mark.pydicom
def test_anonymise_dataset_and_all_is_anonymised_functions(tmp_path):
