Skip to content

Commit 9435582

Browse files
committed
debugged unittest generation
1 parent 4a7e558 commit 9435582

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

nipype2pydra/task/base.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,18 @@ def create_doctests(self, input_fields, nonstd_types):
911911
else:
912912
val = attrs.NOTHING
913913
else:
914-
if isinstance(val, str):
914+
if is_fileset(tp):
915+
val = f"{tp.__name__}.mock({val})"
916+
elif ty.get_origin(tp) is list and is_fileset(ty.get_args(tp)[0]):
917+
val = (
918+
"["
919+
+ ", ".join(
920+
f'{ty.get_args(tp)[0].__name__}.mock("{v}")'
921+
for v in eval(val)
922+
)
923+
+ "]"
924+
)
925+
elif tp is str and not (val.startswith("'") or val.startswith('"')):
915926
val = f'"{val}"'
916927
if val is None and is_fileset(tp):
917928
val = f"{tp.__name__}.mock()"

0 commit comments

Comments
 (0)