@@ -15,6 +15,26 @@ def test_datagrabber():
15
15
yield assert_equal , dg .inputs .base_directory , Undefined
16
16
yield assert_equal , dg .inputs .template_args ,{'outfiles' : []}
17
17
18
+ def test_datagrabber_order ():
19
+ tempdir = mkdtemp ()
20
+ file1 = mkstemp (prefix = 'sub002_L1_R1.q' , dir = tempdir )
21
+ file2 = mkstemp (prefix = 'sub002_L1_R2.q' , dir = tempdir )
22
+ file3 = mkstemp (prefix = 'sub002_L2_R1.q' , dir = tempdir )
23
+ file4 = mkstemp (prefix = 'sub002_L2_R2.q' , dir = tempdir )
24
+ dg = nio .DataGrabber (infields = ['sid' ])
25
+ dg .inputs .base_directory = tempdir
26
+ dg .inputs .template = '%s_L%d_R?.q*'
27
+ dg .inputs .template_args = {'outfiles' : [['sid' , 1 ], ['sid' , 2 ]]}
28
+ dg .inputs .sid = 'sub002'
29
+ dg .inputs .sort_filelist = True
30
+ res = dg .run ()
31
+ outfiles = res .outputs .outfiles
32
+ yield assert_true , 'sub002_L1_R1' in outfiles [0 ][0 ]
33
+ yield assert_true , 'sub002_L1_R2' in outfiles [0 ][1 ]
34
+ yield assert_true , 'sub002_L2_R1' in outfiles [1 ][0 ]
35
+ yield assert_true , 'sub002_L2_R2' in outfiles [1 ][1 ]
36
+ shutil .rmtree (tempdir )
37
+
18
38
def test_datasink ():
19
39
ds = nio .DataSink ()
20
40
yield assert_true , ds .inputs .parameterization
0 commit comments