Skip to content

Commit

Permalink
Merge pull request #154 from simleo/cwl_version_leading_v
Browse files Browse the repository at this point in the history
Handle CWL versions with a leading v
  • Loading branch information
simleo authored Jun 9, 2023
2 parents c925f7c + b44ba10 commit a2cea76
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion rocrate/model/computerlanguage.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def cwl(crate, version=None):
id_ = "https://w3id.org/workflowhub/workflow-ro-crate#cwl"
identifier = "https://w3id.org/cwl/"
if version:
identifier = f"{identifier}v{version}/"
identifier = f"{identifier}v{version.lstrip('v')}/"
properties = {
"name": "Common Workflow Language",
"alternateName": "CWL",
Expand Down
7 changes: 5 additions & 2 deletions test/test_workflow_ro_crate.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def test_create_wf_include(test_data_dir, tmpdir, helpers):
assert f1.read() == f2.read()


@pytest.mark.parametrize("lang_version", [None, "1.2"])
@pytest.mark.parametrize("lang_version", [None, "1.2", "v1.2"])
def test_cwl_lang_version(test_data_dir, lang_version):
wf_id = 'sample_cwl_wf.cwl'
wf_path = test_data_dir / wf_id
Expand All @@ -138,6 +138,9 @@ def test_cwl_lang_version(test_data_dir, lang_version):
if lang_version is None:
assert lang_id == "https://w3id.org/cwl/"
assert "version" not in lang
else:
elif lang_version == "1.2":
assert lang_id == "https://w3id.org/cwl/v1.2/"
assert lang["version"] == "1.2"
else:
assert lang_id == "https://w3id.org/cwl/v1.2/"
assert lang["version"] == "v1.2"

0 comments on commit a2cea76

Please sign in to comment.