def test_add_private_entries_raises_for_non_private_tags(self): new_dict_items = { 0x10021001: ('UL', '1', 'Test One', '', 'TestOne'), 0x10011002: ('DS', '3', 'Test Two', '', 'TestTwo'), } with pytest.raises(ValueError, match='Non-private tags cannot be ' 'added using "add_private_dict_entries"'): add_private_dict_entries('ACME 3.1', new_dict_items)
def test_add_private_entries_raises_for_non_private_tags(self): new_dict_items = { 0x10021001: ('UL', '1', 'Test One', '', 'TestOne'), 0x10011002: ('DS', '3', 'Test Two', '', 'TestTwo'), } with pytest.raises(ValueError, match='Non-private tags cannot be ' 'added using "add_private_dict_entries"'): add_private_dict_entries('ACME 3.1', new_dict_items)
def __init__(self, dataset): """ Parameters ---------- dataset: pydicom.dataset.FileDataset wrap around this dataset """ self.dataset = dataset add_private_dict_entries(self.PRIVATE_CREATOR, self.IDIS_PRIVATE_TAGS)
def test_add_private_entries_raises_for_non_private_tags(self): new_dict_items = { 0x10021001: ('UL', '1', 'Test One', '', 'TestOne'), 0x10011002: ('DS', '3', 'Test Two', '', 'TestTwo'), } msg = (r"Non-private tags cannot be added using " r"'add_private_dict_entries\(\)' \- use " r"'add_dict_entries\(\)' instead") with pytest.raises(ValueError, match=msg): add_private_dict_entries('ACME 3.1', new_dict_items)
def test_add_private_entries(self): """dicom_dictionary: add and use a dict of new dictionary entries""" new_dict_items = { 0x10011001: ('SH', '1', "Test One",), 0x10011002: ('DS', '3', "Test Two", '', 'TestTwo'), } add_private_dict_entries('ACME 3.1', new_dict_items) ds = Dataset() ds[0x10010010] = DataElement(0x10010010, 'LO', 'ACME 3.1') ds[0x10011001] = DataElement(0x10011001, 'SH', 'Test') ds[0x10011002] = DataElement(0x10011002, 'DS', '1\\2\\3') assert 'Test' == ds[0x10011001].value assert [1, 2, 3] == ds[0x10011002].value
def test_add_private_entries(self): """dicom_dictionary: add and use a dict of new dictionary entries""" new_dict_items = { 0x10011001: ('SH', '1', "Test One",), 0x10011002: ('DS', '3', "Test Two", '', 'TestTwo'), } add_private_dict_entries('ACME 3.1', new_dict_items) ds = Dataset() ds[0x10010010] = DataElement(0x10010010, 'LO', 'ACME 3.1') ds[0x10011001] = DataElement(0x10011001, 'SH', 'Test') ds[0x10011002] = DataElement(0x10011002, 'DS', '1\\2\\3') assert 'Test' == ds[0x10011001].value assert [1, 2, 3] == ds[0x10011002].value