11"""Generate fixtures for tests."""
22
33import copy
4- import json
54import os
65from shutil import copyfile
76
1514import nimare
1615from nimare .generate import create_coordinate_dataset
1716from nimare .tests .utils import get_test_data_path
18- from nimare .utils import get_resource_path
17+ from nimare .utils import get_resource_path , load_json
1918
2019# Only enable the following once in a while for a check for SettingWithCopyWarnings
2120# pd.options.mode.chained_assignment = "raise"
@@ -197,8 +196,7 @@ def sample_size_nimads_studyset():
197196 response = request ("GET" , url )
198197 with open (out_file , "wb" ) as f :
199198 f .write (response .content )
200- with open (out_file , "r" ) as f :
201- studyset = json .load (f )
199+ studyset = load_json (out_file )
202200 return studyset
203201
204202
@@ -211,8 +209,7 @@ def _example_nimads_studyset_data():
211209 response = request ("GET" , url )
212210 with open (out_file , "wb" ) as f :
213211 f .write (response .content )
214- with open (out_file , "r" ) as f :
215- studyset = json .load (f )
212+ studyset = load_json (out_file )
216213 return studyset
217214
218215
@@ -231,8 +228,7 @@ def example_nimads_annotation():
231228 response = request ("GET" , url )
232229 with open (out_file , "wb" ) as f :
233230 f .write (response .content )
234- with open (out_file , "r" ) as f :
235- annotation = json .load (f )
231+ annotation = load_json (out_file )
236232 return annotation
237233
238234
0 commit comments