8000 Bug fix of doctest generation by tclose · Pull Request #17 · nipype/nipype2pydra · GitHub
[go: up one dir, main page]

Skip to content

Bug fix of doctest generation #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Mar 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
bug fixed doctests gen
  • Loading branch information
tclose committed Mar 26, 2024
commit 5170a26e2f7b87f02e8a4a711b548e3b3e82e29b
19 changes: 12 additions & 7 deletions nipype2pydra/task/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -914,14 +914,19 @@ def create_doctests(self, input_fields, nonstd_types):
if is_fileset(tp):
val = f"{tp.__name__}.mock({val})"
elif ty.get_origin(tp) is list and is_fileset(ty.get_args(tp)[0]):
val = (
"["
+ ", ".join(
f'{ty.get_args(tp)[0].__name__}.mock("{v}")'
for v in eval(val)
try:
val = eval(val)
except Exception:
pass
else:
val = (
"["
+ ", ".join(
f'{ty.get_args(tp)[0].__name__}.mock("{v}")'
for v in val
)
+ "]"
)
+ "]"
)
elif tp is str and not (val.startswith("'") or val.startswith('"')):
val = f'"{val}"'
if val is None and is_fileset(tp):
Expand Down
0