Skip to content

Commit 53416a3

Browse files
committed
test: Update doctests
1 parent d21991f commit 53416a3

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ jobs:
109109
export TEMPLATEFLOW_USE_DATALAD=on
110110
python -m pytest \
111111
--junit-xml=~/tests/datalad.xml --cov templateflow --doctest-modules \
112-
templateflow/api.py
112+
templateflow/client.py
113113
114114
coverage run --append -m templateflow.cli config
115115
coverage run --append -m templateflow.cli ls MNI152NLin2009cAsym --suffix T1w

templateflow/client.py

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -79,21 +79,23 @@ def ls(self, template, **kwargs):
7979
8080
Examples
8181
--------
82-
>>> ls('MNI152Lin', resolution=1, suffix='T1w', desc=None) # doctest: +ELLIPSIS
82+
>>> client = TemplateFlowClient()
83+
84+
>>> client.ls('MNI152Lin', resolution=1, suffix='T1w', desc=None) # doctest: +ELLIPSIS
8385
[PosixPath('.../tpl-MNI152Lin/tpl-MNI152Lin_res-01_T1w.nii.gz')]
8486
85-
>>> ls('MNI152Lin', resolution=2, suffix='T1w', desc=None) # doctest: +ELLIPSIS
87+
>>> client.ls('MNI152Lin', resolution=2, suffix='T1w', desc=None) # doctest: +ELLIPSIS
8688
[PosixPath('.../tpl-MNI152Lin/tpl-MNI152Lin_res-02_T1w.nii.gz')]
8789
88-
>>> ls('MNI152Lin', suffix='T1w', desc=None) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
90+
>>> client.ls('MNI152Lin', suffix='T1w', desc=None) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
8991
[PosixPath('.../tpl-MNI152Lin/tpl-MNI152Lin_res-01_T1w.nii.gz'),
9092
PosixPath('.../tpl-MNI152Lin/tpl-MNI152Lin_res-02_T1w.nii.gz')]
9193
92-
>>> ls('fsLR', space=None, hemi='L',
93-
... density='32k', suffix='sphere') # doctest: +ELLIPSIS
94+
>>> client.ls('fsLR', space=None, hemi='L',
95+
... density='32k', suffix='sphere') # doctest: +ELLIPSIS
9496
[PosixPath('.../tpl-fsLR_hemi-L_den-32k_sphere.surf.gii')]
9597
96-
>>> ls('fsLR', space='madeup')
98+
>>> client.ls('fsLR', space='madeup')
9799
[]
98100
99101
"""
@@ -138,25 +140,27 @@ def get(self, template, raise_empty=False, **kwargs):
138140
139141
Examples
140142
--------
141-
>>> str(get('MNI152Lin', resolution=1, suffix='T1w', desc=None)) # doctest: +ELLIPSIS
143+
>>> client = TemplateFlowClient()
144+
145+
>>> str(client.get('MNI152Lin', resolution=1, suffix='T1w', desc=None)) # doctest: +ELLIPSIS
142146
'.../tpl-MNI152Lin/tpl-MNI152Lin_res-01_T1w.nii.gz'
143147
144-
>>> str(get('MNI152Lin', resolution=2, suffix='T1w', desc=None)) # doctest: +ELLIPSIS
148+
>>> str(client.get('MNI152Lin', resolution=2, suffix='T1w', desc=None)) # doctest: +ELLIPSIS
145149
'.../tpl-MNI152Lin/tpl-MNI152Lin_res-02_T1w.nii.gz'
146150
147-
>>> [str(p) for p in get(
151+
>>> [str(p) for p in client.get(
148152
... 'MNI152Lin', suffix='T1w', desc=None)] # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
149153
['.../tpl-MNI152Lin/tpl-MNI152Lin_res-01_T1w.nii.gz',
150154
'.../tpl-MNI152Lin/tpl-MNI152Lin_res-02_T1w.nii.gz']
151155
152-
>>> str(get('fsLR', space=None, hemi='L',
156+
>>> str(client.get('fsLR', space=None, hemi='L',
153157
... density='32k', suffix='sphere')) # doctest: +ELLIPSIS
154158
'.../tpl-fsLR_hemi-L_den-32k_sphere.surf.gii'
155159
156-
>>> get('fsLR', space='madeup')
160+
>>> client.get('fsLR', space='madeup')
157161
[]
158162
159-
>>> get('fsLR', raise_empty=True, space='madeup') # doctest: +IGNORE_EXCEPTION_DETAIL
163+
>>> client.get('fsLR', raise_empty=True, space='madeup') # doctest: +IGNORE_EXCEPTION_DETAIL
160164
Traceback (most recent call last):
161165
Exception:
162166
...
@@ -218,7 +222,9 @@ def get_metadata(self, template):
218222
219223
Examples
220224
--------
221-
>>> get_metadata('MNI152Lin')['Name']
225+
>>> client = TemplateFlowClient()
226+
227+
>>> client.get_metadata('MNI152Lin')['Name']
222228
'Linear ICBM Average Brain (ICBM152) Stereotaxic Registration Model'
223229
224230
"""

0 commit comments

Comments
 (0)