1
1
import unittest
2
- from cwlgen .elements import parse_param_type , NON_NULL_CWL_TYPE , CWL_TYPE , DEF_TYPE , CommandInputArraySchema
2
+ from cwlgen .elements import parse_type , NON_NULL_CWL_TYPE , CWL_TYPE , DEF_TYPE , CommandInputArraySchema
3
3
import logging
4
4
5
5
6
6
class TestParamTyping (unittest .TestCase ):
7
7
8
8
def test_types (self ):
9
9
for cwl_type in NON_NULL_CWL_TYPE :
10
- self .assertEqual (parse_param_type (cwl_type ), cwl_type )
10
+ self .assertEqual (parse_type (cwl_type ), cwl_type )
11
11
12
12
def test_incorrect_type (self ):
13
13
invalid_type = "invalid"
14
- should_be_def_type = parse_param_type (invalid_type )
14
+ should_be_def_type = parse_type (invalid_type )
15
15
self .assertNotEqual (should_be_def_type , invalid_type )
16
16
self .assertEqual (should_be_def_type , DEF_TYPE )
17
17
18
18
def test_optional_string (self ):
19
19
for cwl_type in NON_NULL_CWL_TYPE :
20
20
optional_type = cwl_type + "?"
21
- self .assertEqual (parse_param_type (optional_type ), optional_type )
21
+ self .assertEqual (parse_type (optional_type ), optional_type )
22
22
23
23
def test_typed_array (self ):
24
24
array_string_type = "string[]"
25
- q = parse_param_type (array_string_type )
25
+ q = parse_type (array_string_type )
26
26
self .assertIsInstance (q , CommandInputArraySchema )
27
27
self .assertEqual (q .items , "string" )
28
28
29
29
def test_incorrectly_typed_array (self ):
30
30
array_string_type = "invalid[]"
31
- q = parse_param_type (array_string_type )
31
+ q = parse_type (array_string_type )
32
32
self .assertIsInstance (q , CommandInputArraySchema )
33
33
self .assertNotEqual (q .items , "invalid" )
34
34
self .assertEqual (q .items , DEF_TYPE )
35
35
36
36
def test_optionally_typed_array (self ):
37
37
array_string_type = "string?[]"
38
- q = parse_param_type (array_string_type )
38
+ q = parse_type (array_string_type )
39
39
self .assertIsInstance (q , CommandInputArraySchema )
40
40
self .assertEqual (q .items , "string?" )
41
41
42
42
def test_optional_typed_array (self ):
43
43
optional_array_string_type = "string[]?"
44
- q = parse_param_type (optional_array_string_type )
44
+ q = parse_type (optional_array_string_type )
45
45
self .assertIsInstance (q , list )
46
46
self .assertEqual (len (q ), 2 )
47
47
null_idx = q .index (DEF_TYPE )
@@ -52,11 +52,11 @@ def test_optional_typed_array(self):
52
52
def test_command_input_array_schema (self ):
53
53
ar = CommandInputArraySchema (items = "string" )
54
54
self .assertIsInstance (ar , CommandInputArraySchema )
55
- self .assertEqual (parse_param_type (ar ), ar )
55
+ self .assertEqual (parse_type (ar ), ar )
56
56
self .assertEqual (ar .items , "string" )
57
57
58
58
def test_optional_type_input_array_schema (self ):
59
59
ar = CommandInputArraySchema (items = "string?" )
60
60
self .assertIsInstance (ar , CommandInputArraySchema )
61
- self .assertEqual (parse_param_type (ar ), ar )
61
+ self .assertEqual (parse_type (ar ), ar )
62
62
self .assertEqual (ar .items , "string?" )
0 commit comments