Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle CWL versions with a leading v #154

Merged
merged 1 commit into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"