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

unit test for canonicalShape function

parent 97fb4b59
No related branches found
No related tags found
No related merge requests found
......@@ -284,7 +284,7 @@ def _test_Image_atts(imgtype):
dims, pixdims, dtype = atts
expdims = imagewrapper.canonicalShape(dims)
expdims = fslimage.canonicalShape(dims)
expndims = len(expdims)
ndims = len(dims)
pixdims = pixdims[:ndims]
......@@ -340,6 +340,33 @@ def _test_Image_atts2(imgtype):
assert img.intent == intent
def test_canonicalShape():
# (input, expected)
tests = [
((10,), (10, 1, 1)),
((10, 1), (10, 1, 1)),
((10, 1, 1), (10, 1, 1)),
((10, 1, 1, 1), (10, 1, 1)),
((10, 1, 1, 1, 1), (10, 1, 1)),
((10, 10), (10, 10, 1)),
((10, 10, 1), (10, 10, 1)),
((10, 10, 1, 1), (10, 10, 1)),
((10, 10, 1, 1, 1), (10, 10, 1)),
((10, 10, 10), (10, 10, 10)),
((10, 10, 10, 1), (10, 10, 10)),
((10, 10, 10, 1, 1), (10, 10, 10)),
((10, 10, 10, 10), (10, 10, 10, 10)),
((10, 10, 10, 10, 1), (10, 10, 10, 10)),
((10, 10, 10, 10, 1, 1), (10, 10, 10, 10)),
((10, 10, 10, 10, 10), (10, 10, 10, 10, 10)),
((10, 10, 10, 10, 10, 1), (10, 10, 10, 10, 10)),
]
for input, expected in tests:
assert tuple(fslimage.canonicalShape(input)) == expected
def test_looksLikeImage():
"""Test the looksLikeImage function. """
......
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