コード例 #1
0
 def test_optional_typed_array(self):
     optional_array_string_type = "string[]?"
     q = parse_type(optional_array_string_type)
     self.assertIsInstance(q, list)
     self.assertEqual(len(q), 2)
     null_idx = q.index(CwlTypes.DEF_TYPE)
     array_type = q[1 - null_idx]
     self.assertIsInstance(array_type, CommandInputArraySchema)
     self.assertEqual(array_type.items, "string")
コード例 #2
0
 def test_intentional_fail_not_string(self):
     try:
         parse_type({}, requires_type=True)
         self.fail("Failed to throw exception")
     except:
         self.assertTrue(True)
コード例 #3
0
 def test_intentional_fail(self):
     try:
         parse_type("not_a_type", requires_type=True)
         self.fail("Failed to throw exception")
     except Exception as e:
         self.assertTrue(True)
コード例 #4
0
 def test_parse_list_of_items(self):
     t = ["string", "int"]
     types = parse_type(t)
     self.assertListEqual(t, types)
コード例 #5
0
 def test_types(self):
     for cwl_type in CwlTypes.NON_NULL_TYPES:
         self.assertEqual(parse_type(cwl_type), cwl_type)
コード例 #6
0
 def test_optional_type_input_array_schema(self):
     ar = CommandInputArraySchema(items="string?")
     self.assertIsInstance(ar, CommandInputArraySchema)
     self.assertEqual(parse_type(ar), ar)
     self.assertEqual(ar.items, "string?")
コード例 #7
0
 def test_optionally_typed_array(self):
     array_string_type = "string?[]"
     q = parse_type(array_string_type)
     self.assertIsInstance(q, CommandInputArraySchema)
     self.assertEqual(q.items, "string?")
コード例 #8
0
 def test_incorrectly_typed_array(self):
     array_string_type = "invalid[]"
     q = parse_type(array_string_type)
     self.assertIsInstance(q, CommandInputArraySchema)
     self.assertNotEqual(q.items, "invalid")
     self.assertEqual(q.items, CwlTypes.DEF_TYPE)
コード例 #9
0
 def test_optional_string(self):
     for cwl_type in CwlTypes.NON_NULL_TYPES:
         optional_type = cwl_type + "?"
         self.assertEqual(parse_type(optional_type), optional_type)
コード例 #10
0
 def test_incorrect_type(self):
     invalid_type = "invalid"
     should_be_def_type = parse_type(invalid_type)
     self.assertNotEqual(should_be_def_type, invalid_type)
     self.assertEqual(should_be_def_type, CwlTypes.DEF_TYPE)