Esempio n. 1
0
 def test_item_separator_false_separate_optional(self):
     draft2 = {
         "type": [
             "null", {
                 "type": "array",
                 "items": "string"
             }],
         "inputBinding": {
             "prefix": "-a",
             "itemSeparator": None,
             "separate": False
         }
     }
     converted = {
         "type": [
             "null", {
                 "type": "array",
                 "items": "string",
                 "inputBinding": {
                     "prefix": "-a",
                     "separate": False
                 }
             }]
     }
     cwl1 = Input(draft2)
     self.assertEqual(cwl1.cwl["type"], converted["type"])
     self.assertIn("valueFrom", cwl1.cwl["inputBinding"])
     self.assertNotIn("default", cwl1.cwl)
Esempio n. 2
0
 def test_doc(self):
     draft2 = {
         "description": "Some description."
     }
     cwl1 = Input(draft2)
     self.assertEqual(cwl1.cwl['doc'], draft2['description'])
     self.assertNotIn('description', cwl1.cwl)
Esempio n. 3
0
 def test_item_separator_true_separate(self):
     draft2 = {
         "type": [{
             "type": "array",
             "items": "string"
         }],
         "inputBinding": {
             "prefix": "-a",
             "itemSeparator": None,
             "separate": True,
             "position": 1
         }
     }
     converted = {
         "type": [{
             "type": "array",
             "items": "string",
             "inputBinding": {
                 "prefix": "-a",
                 "separate": True
             }
         }],
         "inputBinding": {
             "position": 1,
             "shellQuote": False
         }
     }
     cwl1 = Input(draft2)
     self.assertEqual(cwl1.cwl["type"], converted["type"])
     self.assertIn("valueFrom", cwl1.cwl["inputBinding"])
     # Check that default is not added by mistake
     self.assertNotIn("default", cwl1.cwl)
Esempio n. 4
0
 def test_delete_cmd_include(self):
     draft2 = {
         "inputBinding": {
             "sbg:cmdInclude": True
         }
     }
     cwl1 = Input(draft2, in_id="input")
     self.assertNotIn('sbg:cmdInclude', cwl1.cwl["inputBinding"])
Esempio n. 5
0
 def test_secondary_files_typecheck(self):
     draft2 = {
         "inputBinding": {
             "secondaryFiles": [
                 7
             ]
         }
     }
     with self.assertRaises(Exception):
         Input(draft2)
Esempio n. 6
0
 def test_optional_type(self):
     draft2 = {
         "required": False,
         "type": [
           "File", "null"
         ]
     }
     cwl1 = Input(draft2)
     self.assertEqual(cwl1.cwl['type'], 'File?')
     self.assertNotIn('required', cwl1.cwl)
Esempio n. 7
0
 def test_secondary_files(self):
     draft2 = {
         "inputBinding": {
             "secondaryFiles": [
                 ".bai", ".fai", ".crai"
             ]
         }
     }
     cwl1 = Input(draft2)
     self.assertEqual(cwl1.cwl['secondaryFiles'],
                      draft2["inputBinding"]["secondaryFiles"])
Esempio n. 8
0
 def test_item_separator_without_prefix(self):
     draft2 = {
         "type": [{
             "type": "array",
             "items": "string"
         }],
         "inputBinding": {
             "itemSeparator": 'a'
         }
     }
     cwl1 = Input(draft2)
     self.assertNotIn("itemSeparator", cwl1.cwl["inputBinding"])
Esempio n. 9
0
 def test_enum_name_changed(self):
     draft2 = {
         "id": "#foo",
         "type": [
             "null",
             {
                 "type": "enum",
                 "symbols": ["a", "b"],
                 "name": "null"
             }
         ]
     }
     cwl1 = Input(draft2, in_id='foo')
     self.assertEqual(cwl1.cwl['type'][1]["name"], 'foo')
Esempio n. 10
0
 def test_array_dict_with_no_separator(self):
     draft2 = {
         "type": {
             "type": "array",
             "items": "File"
         },
         "inputBinding": {
             "position": 0,
             "prefix": "-v",
             "separate": True,
         }
     }
     cwl1 = Input(draft2)
     self.assertIn("inputBinding", cwl1.cwl["type"])
Esempio n. 11
0
 def test_record_type_position_added(self):
     draft2 = {
         "required": False,
         "type": [
             {
                 "type": "record",
                 "fields": [
                     {
                         "type": [
                             "File"
                         ],
                         "inputBinding": {
                             "position": 1,
                             "secondaryFiles": []
                         },
                         "name": "input_field"
                     },
                     {
                         "type": [
                             "null",
                             "string"
                         ],
                         "inputBinding": {
                             "position": 1
                         },
                         "name": "input_field_1"
                     }
                 ],
                 "name": "input"
             }
         ]
     }
     cwl1 = Input(draft2)
     self.assertEqual(cwl1.cwl['type']['type'], 'record')
     self.assertEqual(cwl1.cwl['inputBinding']['position'], 1)
     self.assertNotIn('required', cwl1.cwl)
Esempio n. 12
0
    def test_item_separator_without_separate(self):
        draft2 = {
            "type": [{
                "type": "array",
                "items": "string"
            }],
            "inputBinding": {
                "prefix": "-a",
                "itemSeparator": None
            }
        }
        converted = {
            "type": [{
                "type": "array",
                "items": "string",
                "inputBinding": {
                    "prefix": "-a"
                }
            }]
        }

        cwl1 = Input(draft2)
        self.assertEqual(cwl1.cwl["type"], converted["type"])
        self.assertIn("valueFrom", cwl1.cwl["inputBinding"])