def testis_cwl_array_type_explicit_invalid_item(): io_info = { "name": "test", "type": { "type": "array", "items": "unknown-type-item" } } with pytest.raises(PackageTypeError): is_cwl_array_type(io_info)
def testis_cwl_array_type_explicit_optional_shorthand_base(): io_info = {"name": "test", "type": ["null", "string[]"]} res = is_cwl_array_type(io_info) assert res[0] is True assert res[1] == "string" assert res[2] == MODE.NONE assert res[3] == AnyValue
def testis_cwl_array_type_shorthand_enum(): io_info = {"name": "test", "type": "enum[]", "symbols": ["a", "b", "c"]} res = is_cwl_array_type(io_info) assert res[0] is True assert res[1] == "string" assert res[2] == MODE.SIMPLE assert res[3] == ["a", "b", "c"]
def testis_cwl_array_type_explicit_base(): io_info = {"name": "test", "type": {"type": "array", "items": "string"}} res = is_cwl_array_type(io_info) assert res[0] is True assert res[1] == "string" assert res[2] == MODE.NONE assert res[3] == AnyValue
def testis_cwl_array_type_simple_enum(): io_info = {"name": "test", "type": "enum", "symbols": ["a", "b", "c"]} res = is_cwl_array_type(io_info) assert res[0] is False assert res[1] == "enum" assert res[2] == MODE.NONE assert res[3] == AnyValue
def testis_cwl_array_type_explicit_optional_not_array(): io_info = { "name": "test", "type": ["null", "float"], } res = is_cwl_array_type(io_info) assert res[0] is False assert res[1] == "float" assert res[2] == MODE.NONE assert res[3] == AnyValue
def testis_cwl_array_type_shorthand_base(): io_info = { "name": "test", "type": "string[]", } res = is_cwl_array_type(io_info) assert res[0] is True assert res[1] == "string" assert res[2] == MODE.NONE assert res[3] == AnyValue
def testis_cwl_array_type_not_array(): io_info = { "name": "test", "type": "float", } res = is_cwl_array_type(io_info) assert res[0] is False assert res[1] == "float" assert res[2] == MODE.NONE assert res[3] == AnyValue
def testis_cwl_array_type_shorthand_invalid_item(): """ In case of shorthand syntax, because type is only a string, it shouldn't raise. Type is returned as is and value validation is left to later calls. """ io_info = {"name": "test", "type": "unknown[]"} try: res = is_cwl_array_type(io_info) assert res[0] is False assert res[1] == "unknown[]" assert res[2] == MODE.NONE assert res[3] == AnyValue except PackageTypeError: pytest.fail("should not raise an error in this case")
def testis_cwl_array_type_explicit_enum(): io_info = { "name": "test", "type": { "type": "array", "items": { "type": "enum", "symbols": ["a", "b", "c"] } } } res = is_cwl_array_type(io_info) assert res[0] is True assert res[1] == "string" assert res[2] == MODE.SIMPLE assert res[3] == ["a", "b", "c"]