Skip to content

Commit

Permalink
generate many versions and test they are different
Browse files Browse the repository at this point in the history
  • Loading branch information
Volodymyr Savchenko authored and Volodymyr Savchenko committed May 24, 2024
1 parent 61ccf92 commit 381119d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
21 changes: 16 additions & 5 deletions tests/test_absolutize.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,24 @@ def test_make_paths_absolute(self, workflow_id):
rdflib.Graph().parse(data=json.dumps(json_data), format="json-ld")
)

json_data_abs_paths = make_paths_absolute(json_data, BASE_URL, 41, 1)
subjects = []
for version in [1, 2]:
json_data_abs_paths = make_paths_absolute(
json_data, BASE_URL, 41, version
)

parsed_graph = rdflib.Graph().parse(
data=json.dumps(json_data_abs_paths), format="json-ld"
)
parsed_graph = rdflib.Graph().parse(
data=json.dumps(json_data_abs_paths), format="json-ld"
)

assert is_all_absolute(parsed_graph)

subject = parsed_graph.query(
"SELECT ?s WHERE { ?s a <http://schema.org/CreativeWork> }"
).bindings[0]["s"]
subjects.append(subject)

assert is_all_absolute(parsed_graph)
assert subjects[0] != subjects[1]

def test_merged(self):
graph = merge_all_files(
Expand Down
3 changes: 3 additions & 0 deletions workflowhub_graph/absolutize.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import argparse
import copy
import json
from urllib.parse import urlparse
import arcp
Expand Down Expand Up @@ -41,6 +42,8 @@ def make_paths_absolute(
:raises ValueError: If '@context' key is missing or if '@base' key already exists in the JSON content.
"""

json_data = copy.deepcopy(json_data)

workflow_url = (
f"{workflowhub_url}/workflows/{workflow_id}/ro_crate?version={workflow_version}"
)
Expand Down

0 comments on commit 381119d

Please sign in to comment.