1- from pathlib import Path
2-
31from cwl_utils .parser import cwl_v1_0 , cwl_v1_1 , cwl_v1_2 , load_document_by_uri
42
5- from .util import get_data
3+ from .util import get_path
64
75
86def test_cuda_requirement_v1_0 () -> None :
97 """Test that CUDARequirement objects are correctly loaded for CWL v1.0."""
10- uri = (
11- Path (get_data ("testdata/extensions/cuda-requirement_v1_0.cwl" ))
12- .resolve ()
13- .as_uri ()
14- )
8+ uri = get_path ("testdata/extensions/cuda-requirement_v1_0.cwl" ).as_uri ()
159 cwl_obj = load_document_by_uri (uri )
1610 assert isinstance (next (iter (cwl_obj .requirements )), cwl_v1_0 .CUDARequirement )
1711 cwl_dict = cwl_obj .save (top = True )
@@ -20,11 +14,7 @@ def test_cuda_requirement_v1_0() -> None:
2014
2115def test_cuda_requirement_v1_1 () -> None :
2216 """Test that CUDARequirement objects are correctly loaded for CWL v1.1."""
23- uri = (
24- Path (get_data ("testdata/extensions/cuda-requirement_v1_1.cwl" ))
25- .resolve ()
26- .as_uri ()
27- )
17+ uri = get_path ("testdata/extensions/cuda-requirement_v1_1.cwl" ).as_uri ()
2818 cwl_obj = load_document_by_uri (uri )
2919 assert isinstance (next (iter (cwl_obj .requirements )), cwl_v1_1 .CUDARequirement )
3020 cwl_dict = cwl_obj .save (top = True )
@@ -33,11 +23,7 @@ def test_cuda_requirement_v1_1() -> None:
3323
3424def test_cuda_requirement_v1_2 () -> None :
3525 """Test that CUDARequirement objects are correctly loaded for CWL v1.2."""
36- uri = (
37- Path (get_data ("testdata/extensions/cuda-requirement_v1_2.cwl" ))
38- .resolve ()
39- .as_uri ()
40- )
26+ uri = get_path ("testdata/extensions/cuda-requirement_v1_2.cwl" ).as_uri ()
4127 cwl_obj = load_document_by_uri (uri )
4228 assert isinstance (next (iter (cwl_obj .requirements )), cwl_v1_2 .CUDARequirement )
4329 cwl_dict = cwl_obj .save (top = True )
@@ -46,11 +32,7 @@ def test_cuda_requirement_v1_2() -> None:
4632
4733def test_load_listing_requirement_v1_0 () -> None :
4834 """Test that LoadListingRequirement objects are correctly loaded for CWL v1.0."""
49- uri = (
50- Path (get_data ("testdata/extensions/load-listing-requirement_v1_0.cwl" ))
51- .resolve ()
52- .as_uri ()
53- )
35+ uri = get_path ("testdata/extensions/load-listing-requirement_v1_0.cwl" ).as_uri ()
5436 cwl_obj = load_document_by_uri (uri )
5537 assert isinstance (next (iter (cwl_obj .requirements )), cwl_v1_0 .LoadListingRequirement )
5638 cwl_dict = cwl_obj .save (top = True )
@@ -59,11 +41,7 @@ def test_load_listing_requirement_v1_0() -> None:
5941
6042def test_loop_v1_2 () -> None :
6143 """Test that Loop and LoopInput objects are correctly loaded for CWL v1.2."""
62- uri = (
63- Path (get_data ("testdata/extensions/single-var-loop_v1_2.cwl" ))
64- .resolve ()
65- .as_uri ()
66- )
44+ uri = get_path ("testdata/extensions/single-var-loop_v1_2.cwl" ).as_uri ()
6745 cwl_obj = load_document_by_uri (uri )
6846 cwl_step = next (iter (cwl_obj .steps ))
6947 loop_req = next (iter (cwl_step .requirements ))
@@ -75,11 +53,7 @@ def test_loop_v1_2() -> None:
7553
7654def test_inplace_update_requirement_v1_0 () -> None :
7755 """Test that InplaceUpdateRequirement objects are correctly loaded for CWL v1.0."""
78- uri = (
79- Path (get_data ("testdata/extensions/inplace-update-requirement_v1_0.cwl" ))
80- .resolve ()
81- .as_uri ()
82- )
56+ uri = get_path ("testdata/extensions/inplace-update-requirement_v1_0.cwl" ).as_uri ()
8357 cwl_obj = load_document_by_uri (uri )
8458 assert isinstance (
8559 next (iter (cwl_obj .requirements )), cwl_v1_0 .InplaceUpdateRequirement
@@ -90,11 +64,7 @@ def test_inplace_update_requirement_v1_0() -> None:
9064
9165def test_mpi_requirement_v1_0 () -> None :
9266 """Test that MPIRequirement objects are correctly loaded for CWL v1.0."""
93- uri = (
94- Path (get_data ("testdata/extensions/mpi-requirement_v1_0.cwl" ))
95- .resolve ()
96- .as_uri ()
97- )
67+ uri = get_path ("testdata/extensions/mpi-requirement_v1_0.cwl" ).as_uri ()
9868 cwl_obj = load_document_by_uri (uri )
9969 assert isinstance (next (iter (cwl_obj .requirements )), cwl_v1_0 .MPIRequirement )
10070 cwl_dict = cwl_obj .save (top = True )
@@ -103,11 +73,7 @@ def test_mpi_requirement_v1_0() -> None:
10373
10474def test_mpi_requirement_v1_1 () -> None :
10575 """Test that MPIRequirement objects are correctly loaded for CWL v1.1."""
106- uri = (
107- Path (get_data ("testdata/extensions/mpi-requirement_v1_1.cwl" ))
108- .resolve ()
109- .as_uri ()
110- )
76+ uri = get_path ("testdata/extensions/mpi-requirement_v1_1.cwl" ).as_uri ()
11177 cwl_obj = load_document_by_uri (uri )
11278 assert isinstance (next (iter (cwl_obj .requirements )), cwl_v1_1 .MPIRequirement )
11379 cwl_dict = cwl_obj .save (top = True )
@@ -116,11 +82,7 @@ def test_mpi_requirement_v1_1() -> None:
11682
11783def test_mpi_requirement_v1_2 () -> None :
11884 """Test that MPIRequirement objects are correctly loaded for CWL v1.2."""
119- uri = (
120- Path (get_data ("testdata/extensions/mpi-requirement_v1_2.cwl" ))
121- .resolve ()
122- .as_uri ()
123- )
85+ uri = get_path ("testdata/extensions/mpi-requirement_v1_2.cwl" ).as_uri ()
12486 cwl_obj = load_document_by_uri (uri )
12587 assert isinstance (next (iter (cwl_obj .requirements )), cwl_v1_2 .MPIRequirement )
12688 cwl_dict = cwl_obj .save (top = True )
@@ -129,9 +91,7 @@ def test_mpi_requirement_v1_2() -> None:
12991
13092def test_network_access_v1_0 () -> None :
13193 """Test that NetworkAccess objects are correctly loaded for CWL v1.0."""
132- uri = (
133- Path (get_data ("testdata/extensions/network-access_v1_0.cwl" )).resolve ().as_uri ()
134- )
94+ uri = get_path ("testdata/extensions/network-access_v1_0.cwl" ).as_uri ()
13595 cwl_obj = load_document_by_uri (uri )
13696 assert isinstance (next (iter (cwl_obj .requirements )), cwl_v1_0 .NetworkAccess )
13797 cwl_dict = cwl_obj .save (top = True )
@@ -140,11 +100,7 @@ def test_network_access_v1_0() -> None:
140100
141101def test_process_generator_v1_0 () -> None :
142102 """Test that ProcessGenerator objects are correctly loaded for CWL v1.0."""
143- uri = (
144- Path (get_data ("testdata/extensions/process-generator_v1_0.cwl" ))
145- .resolve ()
146- .as_uri ()
147- )
103+ uri = get_path ("testdata/extensions/process-generator_v1_0.cwl" ).as_uri ()
148104 cwl_obj = load_document_by_uri (uri )
149105 assert isinstance (cwl_obj , cwl_v1_0 .ProcessGenerator )
150106 cwl_dict = cwl_obj .save (top = True )
@@ -153,11 +109,7 @@ def test_process_generator_v1_0() -> None:
153109
154110def test_process_generator_v1_1 () -> None :
155111 """Test that ProcessGenerator objects are correctly loaded for CWL v1.1."""
156- uri = (
157- Path (get_data ("testdata/extensions/process-generator_v1_1.cwl" ))
158- .resolve ()
159- .as_uri ()
160- )
112+ uri = get_path ("testdata/extensions/process-generator_v1_1.cwl" ).as_uri ()
161113 cwl_obj = load_document_by_uri (uri )
162114 assert isinstance (cwl_obj , cwl_v1_1 .ProcessGenerator )
163115 cwl_dict = cwl_obj .save (top = True )
@@ -166,11 +118,7 @@ def test_process_generator_v1_1() -> None:
166118
167119def test_process_generator_v1_2 () -> None :
168120 """Test that ProcessGenerator objects are correctly loaded for CWL v1.2."""
169- uri = (
170- Path (get_data ("testdata/extensions/process-generator_v1_2.cwl" ))
171- .resolve ()
172- .as_uri ()
173- )
121+ uri = get_path ("testdata/extensions/process-generator_v1_2.cwl" ).as_uri ()
174122 cwl_obj = load_document_by_uri (uri )
175123 assert isinstance (cwl_obj , cwl_v1_2 .ProcessGenerator )
176124 cwl_dict = cwl_obj .save (top = True )
@@ -179,7 +127,7 @@ def test_process_generator_v1_2() -> None:
179127
180128def test_secrets_v1_0 () -> None :
181129 """Test that Secrets objects are correctly loaded for CWL v1.0."""
182- uri = Path ( get_data ( "testdata/extensions/secrets_v1_0.cwl" )). resolve ( ).as_uri ()
130+ uri = get_path ( "testdata/extensions/secrets_v1_0.cwl" ).as_uri ()
183131 cwl_obj = load_document_by_uri (uri )
184132 assert isinstance (next (iter (cwl_obj .requirements )), cwl_v1_0 .Secrets )
185133 cwl_dict = cwl_obj .save (top = True )
@@ -188,7 +136,7 @@ def test_secrets_v1_0() -> None:
188136
189137def test_secrets_v1_1 () -> None :
190138 """Test that Secrets objects are correctly loaded for CWL v1.1."""
191- uri = Path ( get_data ( "testdata/extensions/secrets_v1_1.cwl" )). resolve ( ).as_uri ()
139+ uri = get_path ( "testdata/extensions/secrets_v1_1.cwl" ).as_uri ()
192140 cwl_obj = load_document_by_uri (uri )
193141 assert isinstance (next (iter (cwl_obj .requirements )), cwl_v1_1 .Secrets )
194142 cwl_dict = cwl_obj .save (top = True )
@@ -197,7 +145,7 @@ def test_secrets_v1_1() -> None:
197145
198146def test_secrets_v1_2 () -> None :
199147 """Test that Secrets objects are correctly loaded for CWL v1.2."""
200- uri = Path ( get_data ( "testdata/extensions/secrets_v1_2.cwl" )). resolve ( ).as_uri ()
148+ uri = get_path ( "testdata/extensions/secrets_v1_2.cwl" ).as_uri ()
201149 cwl_obj = load_document_by_uri (uri )
202150 assert isinstance (next (iter (cwl_obj .requirements )), cwl_v1_2 .Secrets )
203151 cwl_dict = cwl_obj .save (top = True )
@@ -206,7 +154,7 @@ def test_secrets_v1_2() -> None:
206154
207155def test_shm_size_v1_0 () -> None :
208156 """Test that ShmSize objects are correctly loaded for CWL v1.0."""
209- uri = Path ( get_data ( "testdata/extensions/shm-size_v1_0.cwl" )). resolve ( ).as_uri ()
157+ uri = get_path ( "testdata/extensions/shm-size_v1_0.cwl" ).as_uri ()
210158 cwl_obj = load_document_by_uri (uri )
211159 assert isinstance (next (iter (cwl_obj .requirements )), cwl_v1_0 .ShmSize )
212160 cwl_dict = cwl_obj .save (top = True )
@@ -215,7 +163,7 @@ def test_shm_size_v1_0() -> None:
215163
216164def test_shm_size_v1_1 () -> None :
217165 """Test that ShmSize objects are correctly loaded for CWL v1.1."""
218- uri = Path ( get_data ( "testdata/extensions/shm-size_v1_1.cwl" )). resolve ( ).as_uri ()
166+ uri = get_path ( "testdata/extensions/shm-size_v1_1.cwl" ).as_uri ()
219167 cwl_obj = load_document_by_uri (uri )
220168 assert isinstance (next (iter (cwl_obj .requirements )), cwl_v1_1 .ShmSize )
221169 cwl_dict = cwl_obj .save (top = True )
@@ -224,7 +172,7 @@ def test_shm_size_v1_1() -> None:
224172
225173def test_shm_size_v1_2 () -> None :
226174 """Test that ShmSize objects are correctly loaded for CWL v1.2."""
227- uri = Path ( get_data ( "testdata/extensions/shm-size_v1_2.cwl" )). resolve ( ).as_uri ()
175+ uri = get_path ( "testdata/extensions/shm-size_v1_2.cwl" ).as_uri ()
228176 cwl_obj = load_document_by_uri (uri )
229177 assert isinstance (next (iter (cwl_obj .requirements )), cwl_v1_2 .ShmSize )
230178 cwl_dict = cwl_obj .save (top = True )
@@ -233,7 +181,7 @@ def test_shm_size_v1_2() -> None:
233181
234182def test_time_limit_v1_0 () -> None :
235183 """Test that TimeLimit objects are correctly loaded for CWL v1.0."""
236- uri = Path ( get_data ( "testdata/extensions/time-limit_v1_0.cwl" )). resolve ( ).as_uri ()
184+ uri = get_path ( "testdata/extensions/time-limit_v1_0.cwl" ).as_uri ()
237185 cwl_obj = load_document_by_uri (uri )
238186 assert isinstance (next (iter (cwl_obj .requirements )), cwl_v1_0 .TimeLimit )
239187 cwl_dict = cwl_obj .save (top = True )
@@ -242,7 +190,7 @@ def test_time_limit_v1_0() -> None:
242190
243191def test_work_reuse_v1_0 () -> None :
244192 """Test that WorkReuse objects are correctly loaded for CWL v1.0."""
245- uri = Path ( get_data ( "testdata/extensions/work-reuse_v1_0.cwl" )). resolve ( ).as_uri ()
193+ uri = get_path ( "testdata/extensions/work-reuse_v1_0.cwl" ).as_uri ()
246194 cwl_obj = load_document_by_uri (uri )
247195 assert isinstance (next (iter (cwl_obj .requirements )), cwl_v1_0 .WorkReuse )
248196 cwl_dict = cwl_obj .save (top = True )
0 commit comments