Skip to content
Snippets Groups Projects
Commit e7390bf9 authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

TEST: Fix dicom tests (were using deprecated methods)

parent dbde2fca
No related branches found
No related tags found
No related merge requests found
...@@ -47,9 +47,13 @@ def test_enabled(): ...@@ -47,9 +47,13 @@ def test_enabled():
side_effect=Exception()): side_effect=Exception()):
assert not fsldcm.enabled() assert not fsldcm.enabled()
# test presence of different versions # test presence of different versions
tests = [(b'version v2.1.20191212', True), tests = [(b'version v2.1.20191212', True),
(b'version v1.0.20160930', True), (b'version v1.0.20171216', True),
(b'version v1.0.20171215', True),
(b'version v1.0.20171214', False),
(b'version v1.0.20160930', False),
(b'version v1.0.20160929', False), (b'version v1.0.20160929', False),
(b'version v0.0.00000000', False), (b'version v0.0.00000000', False),
(b'version blurgh', False)] (b'version blurgh', False)]
...@@ -76,7 +80,7 @@ def test_scanDir(): ...@@ -76,7 +80,7 @@ def test_scanDir():
f.extractall() f.extractall()
series = fsldcm.scanDir(td) series = fsldcm.scanDir(td)
assert len(series) == 2 assert len(series) == 3
for s in series: for s in series:
assert (s['PatientName'] == 'MCCARTHY_PAUL' or assert (s['PatientName'] == 'MCCARTHY_PAUL' or
...@@ -104,13 +108,13 @@ def test_loadSeries(): ...@@ -104,13 +108,13 @@ def test_loadSeries():
for img in imgs: for img in imgs:
assert img.dicomDir == td assert img.dicomDir == td
assert img.shape == expShape assert img.shape == expShape
assert img[:].shape == expShape assert img[:].shape == expShape
assert img.get('PatientName') == 'MCCARTHY_PAUL' or \ assert img.getMeta('PatientName') == 'MCCARTHY_PAUL' or \
img.get('PatientName') == 'MCCARTHY_PAUL_2' img.getMeta('PatientName') == 'MCCARTHY_PAUL_2'
assert 'PatientName' in img.keys() assert 'PatientName' in img.metaKeys()
assert 'MCCARTHY_PAUL' in img.values() or \ assert 'MCCARTHY_PAUL' in img.metaValues() or \
'MCCARTHY_PAUL_2' in img.values() 'MCCARTHY_PAUL_2' in img.metaValues()
assert ('PatientName', 'MCCARTHY_PAUL') in img.items() or \ assert ('PatientName', 'MCCARTHY_PAUL') in img.metaItems() or \
('PatientName', 'MCCARTHY_PAUL_2') in img.items() ('PatientName', 'MCCARTHY_PAUL_2') in img.metaItems()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment