Skip to content
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

MAINT: Various minor improvements to complement previous PR #2964

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ inplace:
$(PYTHON) setup.py build_ext -i

test-code: in
py.test --doctest-module nipype
py.test --doctest-modules nipype

test-coverage: clean-tests in
py.test --doctest-modules --cov-config .coveragerc --cov=nipype nipype
Expand Down
11 changes: 7 additions & 4 deletions nipype/algorithms/tests/test_auto_ACompCor.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ def test_ACompCor_inputs():
),
num_components=dict(xor=['variance_threshold'], ),
pre_filter=dict(usedefault=True, ),
realigned_file=dict(mandatory=True, ),
realigned_file=dict(
extensions=None,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the spec tests, only explicitly specified metadata has gone in, previously. Why is extensions different?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an oversight from the previous PR - 6c3858a#diff-07934241447dd5e65f51347e36fdd1ffR291

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. But, for example, exists=False is not in all of these, even though that's the default. Why is extensions=<default> in here? Is this something we can fix in the trait, instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could (and it was like that before that commit) replicate the same behavior of exists. Namely, the metadata is not propagated up to the base classes. I'm clueless about the implications of this.

For exists I just kept the original behavior.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think the intent was not so much to track the defaults of the class, but keywords that the user put in explicitly.

i do agree that these underlying metadata (if changed internally in traits_extension) will change the behavior of interfaces and it would be good to catch them. another side note, is how we deal with and improve pickled crashfile compatibility.

if we keep old behavior, then we must commit to not changing underlying defaults in traits_extension in the future.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@satra Just to clarify, adding extensions metadata to everything is preferable?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@effigies - if we do want to take note of underlying metadata changes, we either write a set of tests for each trait type that's used in nipype, and not add the defaults to these auto-tests.

or we simply pull every default into the auto test. more generally though, my hope is that we can move closer to the kind of testing we are planning to do with the afni folks. also start splitting interfaces into their own packages.

so for now, i think this ok. but we should think this through/generalize our goals a bit better.

mandatory=True,
),
regress_poly_degree=dict(usedefault=True, ),
repetition_time=dict(),
save_metadata=dict(usedefault=True, ),
Expand All @@ -40,9 +43,9 @@ def test_ACompCor_inputs():
assert getattr(inputs.traits()[key], metakey) == value
def test_ACompCor_outputs():
output_map = dict(
components_file=dict(),
metadata_file=dict(),
pre_filter_file=dict(),
components_file=dict(extensions=None, ),
metadata_file=dict(extensions=None, ),
pre_filter_file=dict(extensions=None, ),
)
outputs = ACompCor.output_spec()

Expand Down
6 changes: 3 additions & 3 deletions nipype/algorithms/tests/test_auto_ActivationCount.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ def test_ActivationCount_inputs():
assert getattr(inputs.traits()[key], metakey) == value
def test_ActivationCount_outputs():
output_map = dict(
acm_neg=dict(),
acm_pos=dict(),
out_file=dict(),
acm_neg=dict(extensions=None, ),
acm_pos=dict(extensions=None, ),
out_file=dict(extensions=None, ),
)
outputs = ActivationCount.output_spec()

Expand Down
12 changes: 9 additions & 3 deletions nipype/algorithms/tests/test_auto_AddCSVColumn.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,22 @@ def test_AddCSVColumn_inputs():
input_map = dict(
extra_column_heading=dict(),
extra_field=dict(),
in_file=dict(mandatory=True, ),
out_file=dict(usedefault=True, ),
in_file=dict(
extensions=None,
mandatory=True,
),
out_file=dict(
extensions=None,
usedefault=True,
),
)
inputs = AddCSVColumn.input_spec()

for key, metadata in list(input_map.items()):
for metakey, value in list(metadata.items()):
assert getattr(inputs.traits()[key], metakey) == value
def test_AddCSVColumn_outputs():
output_map = dict(csv_file=dict(), )
output_map = dict(csv_file=dict(extensions=None, ), )
outputs = AddCSVColumn.output_spec()

for key, metadata in list(output_map.items()):
Expand Down
2 changes: 1 addition & 1 deletion nipype/algorithms/tests/test_auto_AddCSVRow.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def test_AddCSVRow_inputs():
for metakey, value in list(metadata.items()):
assert getattr(inputs.traits()[key], metakey) == value
def test_AddCSVRow_outputs():
output_map = dict(csv_file=dict(), )
output_map = dict(csv_file=dict(extensions=None, ), )
outputs = AddCSVRow.output_spec()

for key, metadata in list(output_map.items()):
Expand Down
11 changes: 7 additions & 4 deletions nipype/algorithms/tests/test_auto_AddNoise.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ def test_AddNoise_inputs():
mandatory=True,
usedefault=True,
),
in_file=dict(mandatory=True, ),
in_mask=dict(),
out_file=dict(),
in_file=dict(
extensions=None,
mandatory=True,
),
in_mask=dict(extensions=None, ),
out_file=dict(extensions=None, ),
snr=dict(usedefault=True, ),
)
inputs = AddNoise.input_spec()
Expand All @@ -24,7 +27,7 @@ def test_AddNoise_inputs():
for metakey, value in list(metadata.items()):
assert getattr(inputs.traits()[key], metakey) == value
def test_AddNoise_outputs():
output_map = dict(out_file=dict(), )
output_map = dict(out_file=dict(extensions=None, ), )
outputs = AddNoise.output_spec()

for key, metadata in list(output_map.items()):
Expand Down
2 changes: 1 addition & 1 deletion nipype/algorithms/tests/test_auto_ArtifactDetect.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def test_ArtifactDetect_inputs():
bound_by_brainmask=dict(usedefault=True, ),
global_threshold=dict(usedefault=True, ),
intersect_mask=dict(usedefault=True, ),
mask_file=dict(),
mask_file=dict(extensions=None, ),
mask_threshold=dict(),
mask_type=dict(mandatory=True, ),
norm_threshold=dict(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
def test_CalculateNormalizedMoments_inputs():
input_map = dict(
moment=dict(mandatory=True, ),
timeseries_file=dict(mandatory=True, ),
timeseries_file=dict(
extensions=None,
mandatory=True,
),
)
inputs = CalculateNormalizedMoments.input_spec()

Expand Down
24 changes: 15 additions & 9 deletions nipype/algorithms/tests/test_auto_ComputeDVARS.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@ def test_ComputeDVARS_inputs():
figdpi=dict(usedefault=True, ),
figformat=dict(usedefault=True, ),
figsize=dict(usedefault=True, ),
in_file=dict(mandatory=True, ),
in_mask=dict(mandatory=True, ),
in_file=dict(
extensions=None,
mandatory=True,
),
in_mask=dict(
extensions=None,
mandatory=True,
),
intensity_normalization=dict(usedefault=True, ),
remove_zerovariance=dict(usedefault=True, ),
save_all=dict(usedefault=True, ),
Expand All @@ -29,13 +35,13 @@ def test_ComputeDVARS_outputs():
avg_nstd=dict(),
avg_std=dict(),
avg_vxstd=dict(),
fig_nstd=dict(),
fig_std=dict(),
fig_vxstd=dict(),
out_all=dict(),
out_nstd=dict(),
out_std=dict(),
out_vxstd=dict(),
fig_nstd=dict(extensions=None, ),
fig_std=dict(extensions=None, ),
fig_vxstd=dict(extensions=None, ),
out_all=dict(extensions=None, ),
out_nstd=dict(extensions=None, ),
out_std=dict(extensions=None, ),
out_vxstd=dict(extensions=None, ),
)
outputs = ComputeDVARS.output_spec()

Expand Down
24 changes: 18 additions & 6 deletions nipype/algorithms/tests/test_auto_ComputeMeshWarp.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,22 @@
def test_ComputeMeshWarp_inputs():
input_map = dict(
metric=dict(usedefault=True, ),
out_file=dict(usedefault=True, ),
out_warp=dict(usedefault=True, ),
surface1=dict(mandatory=True, ),
surface2=dict(mandatory=True, ),
out_file=dict(
extensions=None,
usedefault=True,
),
out_warp=dict(
extensions=None,
usedefault=True,
),
surface1=dict(
extensions=None,
mandatory=True,
),
surface2=dict(
extensions=None,
mandatory=True,
),
weighting=dict(usedefault=True, ),
)
inputs = ComputeMeshWarp.input_spec()
Expand All @@ -20,8 +32,8 @@ def test_ComputeMeshWarp_inputs():
def test_ComputeMeshWarp_outputs():
output_map = dict(
distance=dict(),
out_file=dict(),
out_warp=dict(),
out_file=dict(extensions=None, ),
out_warp=dict(extensions=None, ),
)
outputs = ComputeMeshWarp.output_spec()

Expand Down
12 changes: 9 additions & 3 deletions nipype/algorithms/tests/test_auto_CreateNifti.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,22 @@
def test_CreateNifti_inputs():
input_map = dict(
affine=dict(),
data_file=dict(mandatory=True, ),
header_file=dict(mandatory=True, ),
data_file=dict(
extensions=None,
mandatory=True,
),
header_file=dict(
extensions=None,
mandatory=True,
),
)
inputs = CreateNifti.input_spec()

for key, metadata in list(input_map.items()):
for metakey, value in list(metadata.items()):
assert getattr(inputs.traits()[key], metakey) == value
def test_CreateNifti_outputs():
output_map = dict(nifti_file=dict(), )
output_map = dict(nifti_file=dict(extensions=None, ), )
outputs = CreateNifti.output_spec()

for key, metadata in list(output_map.items()):
Expand Down
14 changes: 10 additions & 4 deletions nipype/algorithms/tests/test_auto_Distance.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@

def test_Distance_inputs():
input_map = dict(
mask_volume=dict(),
mask_volume=dict(extensions=None, ),
method=dict(usedefault=True, ),
volume1=dict(mandatory=True, ),
volume2=dict(mandatory=True, ),
volume1=dict(
extensions=None,
mandatory=True,
),
volume2=dict(
extensions=None,
mandatory=True,
),
)
inputs = Distance.input_spec()

Expand All @@ -18,7 +24,7 @@ def test_Distance_inputs():
def test_Distance_outputs():
output_map = dict(
distance=dict(),
histogram=dict(),
histogram=dict(extensions=None, ),
point1=dict(),
point2=dict(),
)
Expand Down
19 changes: 14 additions & 5 deletions nipype/algorithms/tests/test_auto_FramewiseDisplacement.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,19 @@ def test_FramewiseDisplacement_inputs():
input_map = dict(
figdpi=dict(usedefault=True, ),
figsize=dict(usedefault=True, ),
in_file=dict(mandatory=True, ),
in_file=dict(
extensions=None,
mandatory=True,
),
normalize=dict(usedefault=True, ),
out_figure=dict(usedefault=True, ),
out_file=dict(usedefault=True, ),
out_figure=dict(
extensions=None,
usedefault=True,
),
out_file=dict(
extensions=None,
usedefault=True,
),
parameter_source=dict(mandatory=True, ),
radius=dict(usedefault=True, ),
save_plot=dict(usedefault=True, ),
Expand All @@ -24,8 +33,8 @@ def test_FramewiseDisplacement_inputs():
def test_FramewiseDisplacement_outputs():
output_map = dict(
fd_average=dict(),
out_figure=dict(),
out_file=dict(),
out_figure=dict(extensions=None, ),
out_file=dict(extensions=None, ),
)
outputs = FramewiseDisplacement.output_spec()

Expand Down
7 changes: 5 additions & 2 deletions nipype/algorithms/tests/test_auto_FuzzyOverlap.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@

def test_FuzzyOverlap_inputs():
input_map = dict(
in_mask=dict(),
in_mask=dict(extensions=None, ),
in_ref=dict(mandatory=True, ),
in_tst=dict(mandatory=True, ),
out_file=dict(usedefault=True, ),
out_file=dict(
extensions=None,
usedefault=True,
),
weighting=dict(usedefault=True, ),
)
inputs = FuzzyOverlap.input_spec()
Expand Down
8 changes: 6 additions & 2 deletions nipype/algorithms/tests/test_auto_Gunzip.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@


def test_Gunzip_inputs():
input_map = dict(in_file=dict(mandatory=True, ), )
input_map = dict(
in_file=dict(
extensions=None,
mandatory=True,
), )
inputs = Gunzip.input_spec()

for key, metadata in list(input_map.items()):
for metakey, value in list(metadata.items()):
assert getattr(inputs.traits()[key], metakey) == value
def test_Gunzip_outputs():
output_map = dict(out_file=dict(), )
output_map = dict(out_file=dict(extensions=None, ), )
outputs = Gunzip.output_spec()

for key, metadata in list(output_map.items()):
Expand Down
11 changes: 7 additions & 4 deletions nipype/algorithms/tests/test_auto_ICC.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@

def test_ICC_inputs():
input_map = dict(
mask=dict(mandatory=True, ),
mask=dict(
extensions=None,
mandatory=True,
),
subjects_sessions=dict(mandatory=True, ),
)
inputs = ICC.input_spec()
Expand All @@ -15,9 +18,9 @@ def test_ICC_inputs():
assert getattr(inputs.traits()[key], metakey) == value
def test_ICC_outputs():
output_map = dict(
icc_map=dict(),
session_var_map=dict(),
subject_var_map=dict(),
icc_map=dict(extensions=None, ),
session_var_map=dict(extensions=None, ),
subject_var_map=dict(extensions=None, ),
)
outputs = ICC.output_spec()

Expand Down
5 changes: 4 additions & 1 deletion nipype/algorithms/tests/test_auto_Matlab2CSV.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@

def test_Matlab2CSV_inputs():
input_map = dict(
in_file=dict(mandatory=True, ),
in_file=dict(
extensions=None,
mandatory=True,
),
reshape_matrix=dict(usedefault=True, ),
)
inputs = Matlab2CSV.input_spec()
Expand Down
7 changes: 5 additions & 2 deletions nipype/algorithms/tests/test_auto_MergeCSVFiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ def test_MergeCSVFiles_inputs():
extra_column_heading=dict(),
extra_field=dict(),
in_files=dict(mandatory=True, ),
out_file=dict(usedefault=True, ),
out_file=dict(
extensions=None,
usedefault=True,
),
row_heading_title=dict(usedefault=True, ),
row_headings=dict(),
)
Expand All @@ -19,7 +22,7 @@ def test_MergeCSVFiles_inputs():
for metakey, value in list(metadata.items()):
assert getattr(inputs.traits()[key], metakey) == value
def test_MergeCSVFiles_outputs():
output_map = dict(csv_file=dict(), )
output_map = dict(csv_file=dict(extensions=None, ), )
outputs = MergeCSVFiles.output_spec()

for key, metadata in list(output_map.items()):
Expand Down
Loading