Skip to content

Commit ad44896

Browse files
committed
FIX: report.rst terminal output
1 parent 460f616 commit ad44896

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

nipype/utils/filemanip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ def write_rst_header(header, level=0):
736736

737737
def write_rst_list(items, prefix=""):
738738
out = []
739-
for item in items:
739+
for item in ensure_list(items):
740740
out.append("{} {}".format(prefix, str(item)))
741741
return "\n".join(out) + "\n\n"
742742

nipype/utils/tests/test_filemanip.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
loadcrash,
3131
savepkl,
3232
path_resolve,
33+
write_rst_list,
3334
)
3435

3536

@@ -652,3 +653,17 @@ def test_pickle(tmp_path, save_versioning):
652653
savepkl(pickle_fname, testobj, versioning=save_versioning)
653654
outobj = loadpkl(pickle_fname)
654655
assert outobj == testobj
656+
657+
658+
@pytest.mark.parametrize("items,expected", [
659+
('', ' \n\n'),
660+
('A string', ' A string\n\n'),
661+
(['A list', 'Of strings'], ' A list\n Of strings\n\n'),
662+
(None, TypeError),
663+
])
664+
def test_write_rst_list(tmp_path, items, expected):
665+
if items is not None:
666+
assert write_rst_list(items) == expected
667+
else:
668+
with pytest.raises(expected):
669+
write_rst_list(items)

0 commit comments

Comments
 (0)