Skip to content
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 case_utils/case_sparql_construct/__init__.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -78,7 +78,7 @@ def main():
"format": output_format
}
if output_format == "json-ld":
context_dictionary = {k:v for (k,v) in graph.namespace_manager.namespaces()}
context_dictionary = {k:v for (k,v) in out_graph.namespace_manager.namespaces()}
serialize_kwargs["context"] = context_dictionary

out_graph.serialize(args.out_graph, **serialize_kwargs)
Expand Down
1 change: 1 addition & 0 deletions tests/case_sparql_construct/.gitignore
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
output.json
output.ttl
5 changes: 3 additions & 2 deletions tests/case_sparql_construct/Makefile
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,6 +21,7 @@ all: \
output.ttl

check: \
output.json \
output.ttl
source $(tests_srcdir)/venv/bin/activate \
&& pytest \
Expand All@@ -30,10 +31,10 @@ clean:
@rm -rf \
__pycache__
@rm -f \
output.ttl \
output.* \
_*

output.ttl: \
output.%: \
$(tests_srcdir)/.venv.done.log \
$(top_srcdir)/case_utils/case_sparql_construct/__init__.py \
input-1.sparql \
Expand Down
9 changes: 7 additions & 2 deletions tests/case_sparql_construct/test_case_sparql_construct.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,15 +15,15 @@

import case_utils

def test_templates_with_blank_nodes_result():
def _test_templates_with_blank_nodes_result(filename):
ground_truth_positive = {
("Alice", "Hacker"),
("Bob", "Hacker")
}
ground_truth_negative = set()

graph = rdflib.Graph()
graph.parse("output.ttl", format=case_utils.guess_format("output.ttl"))
graph.parse(filename, format=case_utils.guess_format(filename))

computed = set()
query_string = """\
Expand All@@ -47,3 +47,8 @@ def test_templates_with_blank_nodes_result():
l_family_name.toPython()
))
assert computed == ground_truth_positive

def test_templates_with_blank_nodes_result_json():
_test_templates_with_blank_nodes_result("output.json")
def test_templates_with_blank_nodes_result_turtle():
_test_templates_with_blank_nodes_result("output.ttl")