Skip to content

Commit 2a761c5

Browse files
committed
Fix test formatting
1 parent 0a6dbb9 commit 2a761c5

1 file changed

Lines changed: 18 additions & 18 deletions

File tree

tests/test_anon.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ def test_deleted_tags_are_removed(orig_anon_dataset):
9090
# TODO: Investigate why Date type are replaced instead of deleted
9191
# See issue https://github.com/KitwareMedical/dicom-anonymizer/issues/56
9292
if orig_ds[tt].VR != "DA": # sourcery skip: no-conditionals-in-tests
93-
assert (
94-
tt not in anon_ds
95-
), f"({tt[0]:04X},{tt[1]:04x}):{orig_ds[tt].value}->{anon_ds[tt].value}"
93+
assert tt not in anon_ds, (
94+
f"({tt[0]:04X},{tt[1]:04x}):{orig_ds[tt].value}->{anon_ds[tt].value}"
95+
)
9696

9797

9898
changed_tags = (
@@ -113,9 +113,9 @@ def is_elem_replaced(orig, anon) -> bool:
113113
for tt in changed_tags:
114114
if tt in x and len(x[tt].value) > 0:
115115
assert tt in y, f"({tt[0]:04X},{tt[1]:04x}):{x[tt].value}->missing!"
116-
assert is_elem_replaced(
117-
x[tt], y[tt]
118-
), f"({tt[0]:04X},{tt[1]:04x}):{x[tt].value} not replaced"
116+
assert is_elem_replaced(x[tt], y[tt]), (
117+
f"({tt[0]:04X},{tt[1]:04x}):{x[tt].value} not replaced"
118+
)
119119
return True
120120

121121
return orig.value != anon.value if orig.value not in empty_values else True
@@ -126,12 +126,12 @@ def test_changed_tags_are_replaced(orig_anon_dataset):
126126

127127
for tt in changed_tags: # sourcery skip: no-loop-in-tests
128128
if tt in orig_ds: # sourcery skip: no-conditionals-in-tests
129-
assert (
130-
tt in anon_ds
131-
), f"({tt[0]:04X},{tt[1]:04x}):{orig_ds[tt].value}->missing!"
132-
assert is_elem_replaced(
133-
orig_ds[tt], anon_ds[tt]
134-
), f"({tt[0]:04X},{tt[1]:04x}):{orig_ds[tt].value} not replaced"
129+
assert tt in anon_ds, (
130+
f"({tt[0]:04X},{tt[1]:04x}):{orig_ds[tt].value}->missing!"
131+
)
132+
assert is_elem_replaced(orig_ds[tt], anon_ds[tt]), (
133+
f"({tt[0]:04X},{tt[1]:04x}):{orig_ds[tt].value} not replaced"
134+
)
135135

136136

137137
empty_tags = dicomfields_2023.Z_TAGS + dicomfields_2023.X_Z_TAGS
@@ -142,9 +142,9 @@ def is_elem_empty(elem) -> bool:
142142
for x in elem.value:
143143
for tt in empty_tags:
144144
if tt in x and len(x[tt].value) > 0:
145-
assert is_elem_empty(
146-
x[tt]
147-
), f"({tt[0]:04X},{tt[1]:04x}):{x[tt].value} is not empty"
145+
assert is_elem_empty(x[tt]), (
146+
f"({tt[0]:04X},{tt[1]:04x}):{x[tt].value} is not empty"
147+
)
148148
return True
149149

150150
return elem.value in empty_values
@@ -157,9 +157,9 @@ def test_empty_tags_are_emptied(orig_anon_dataset):
157157
if (
158158
tt in orig_ds and len(orig_ds[tt].value) > 0
159159
): # sourcery skip: no-conditionals-in-tests
160-
assert is_elem_empty(
161-
anon_ds[tt]
162-
), f"({tt[0]:04X},{tt[1]:04x}):{anon_ds[tt].value} is not empty"
160+
assert is_elem_empty(anon_ds[tt]), (
161+
f"({tt[0]:04X},{tt[1]:04x}):{anon_ds[tt].value} is not empty"
162+
)
163163

164164

165165
def test_private_tags_are_removed(dataset_with_private_fields):

0 commit comments

Comments
 (0)