Skip to content

Commit

Permalink
TST: Move private variable testing to unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
mgxd committed Jan 9, 2025
1 parent 343cdb3 commit 83b887e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
7 changes: 0 additions & 7 deletions niworkflows/interfaces/bids.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,18 +253,11 @@ class BIDSDataGrabber(SimpleInterface):
>>> bids_src.inputs.subject_data = bids_collect_data(
... str(datadir / 'ds114'), '01', bids_validate=False)[0]
>>> bids_src.inputs.subject_id = '01'
>>> bids_src._require_t1w
True
>>> bids_src._require_funcs
True
>>> res = bids_src.run()
>>> res.outputs.t1w # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
['.../ds114/sub-01/ses-retest/anat/sub-01_ses-retest_T1w.nii.gz',
'.../ds114/sub-01/ses-test/anat/sub-01_ses-test_T1w.nii.gz']
>>> bids_src = BIDSDataGrabber(require_t1w=False)
>>> bids_src._require_t1w
False
"""

input_spec = _BIDSDataGrabberInputSpec
Expand Down
13 changes: 13 additions & 0 deletions niworkflows/interfaces/tests/test_bids.py
Original file line number Diff line number Diff line change
Expand Up @@ -793,3 +793,16 @@ def test_fsdir_min_version(tmp_path, min_version):
assert not patched_subject_dir.exists()
else:
assert patched_subject_dir.exists()


def test_BIDSDataGrabber():
x = bintfs.BIDSDataGrabber(anat_only=True)
assert x._require_t1w is True
assert x._require_funcs is False

x = bintfs.BIDSDataGrabber(anat_only=False, require_t1w=False)
assert x._require_t1w is False
assert x._require_funcs is True

x = bintfs.BIDSDataGrabber(anat_derivatives='derivatives')
assert x._require_t1w is False

0 comments on commit 83b887e

Please sign in to comment.