Skip to content

Commit

Permalink
checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
aucampia committed Mar 8, 2023
1 parent 9015546 commit 372a8fc
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 58 deletions.
5 changes: 1 addition & 4 deletions test/data/variants/diverse_triples.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
"@graph": [
{
"@id": "egschema:object",
"eghttp:predicate": {
"@value": "XSD string",
"@type": "xsd:string"
}
"eghttp:predicate": "XSD string"
},
{
"@id": "egschema:subject",
Expand Down
2 changes: 1 addition & 1 deletion test/data/variants/diverse_triples.nt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<http://example.com/subject> <http://example.com/predicate> "日本語の表記体系"@jpx .
<urn:example:subject> <example:predicate> <example:subject> .
<example:object> <http://example.com/predicate> "XSD string"^^<http://www.w3.org/2001/XMLSchema#string> .
<example:object> <http://example.com/predicate> "XSD string" .
<example:subject> <example:predicate> <example:object> .
<example:subject> <example:predicate> "12"^^<http://www.w3.org/2001/XMLSchema#integer> .
4 changes: 1 addition & 3 deletions test/test_graph/test_variants.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,7 @@ def for_files(
else:
graph_variant = graph_varaint_dict[file_key]
if variant_key.endswith("-asserts.json"):
graph_variant.asserts = GraphAsserts(
**json.loads(file_path.read_text())
)
graph_variant.asserts = GraphAsserts.from_path(file_path)
else:
graph_variant.variants[variant_key] = file_path
return graph_varaint_dict
Expand Down
24 changes: 1 addition & 23 deletions test/test_misc/test_input_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ def check(
elif self.stream_check is StreamCheck.GRAPH:
graph = Graph()
graph.parse(input_source, format=params.format)
assert len(graph) > 0
GraphHelper.assert_triple_sets_equals(BASE_GRAPH, graph)
else:
raise ValueError(f"unsupported stream_check value {self.stream_check}")
Expand Down Expand Up @@ -460,7 +461,6 @@ def as_pytest_param(


VARIANTS_DIR = TEST_DATA_DIR.relative_to(Path.cwd()) / "variants"
# ASSERTS = GraphAsserts.from_path(VARIANTS_DIR / "diverse_triples-asserts.json")
BASE_GRAPH = Graph()
BASE_GRAPH.parse(VARIANTS_DIR / "diverse_triples.nt", format="nt")

Expand Down Expand Up @@ -578,7 +578,6 @@ def make_params(
if (
stream_check == StreamCheck.GRAPH
and format == "xml"
# and param in (LocationParam.FILE_URI, LocationParam.HTTP_URI)
):
marks = (
pytest.mark.xfail(
Expand All @@ -589,27 +588,6 @@ def make_params(
param, stream_check, expected_encoding, format, marks=marks
)

# for (param, format, stream_check) in itertools.product(
# itertools.chain(LocationParam),
# formats.difference({default_format}),
# (StreamCheck.BYTE, StreamCheck.GRAPH),
# ):
# marks: Union[
# pytest.MarkDecorator, Collection[Union[pytest.MarkDecorator, pytest.Mark]]
# ] = ()
# if (param, format, stream_check) in (
# (LocationParam.FILE_URI, "xml", StreamCheck.GRAPH),
# (LocationParam.HTTP_URI, "xml", StreamCheck.GRAPH),
# ):
# marks = (
# pytest.mark.xfail(
# reason="datatype mismatch ...", raises=AssertionError
# ),
# )
# yield from make_params(
# param, stream_check, Holder(None), format=format, marks=marks
# )

for param in LocationParam:
yield from make_params(
param,
Expand Down
19 changes: 0 additions & 19 deletions test/test_parsers/test_parser_hext.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,11 @@
import sys
from pathlib import Path

from rdflib.graph import Graph

sys.path.append(str(Path(__file__).parent.parent.absolute()))
from rdflib import ConjunctiveGraph, Dataset, Literal
from rdflib.namespace import XSD


def test_small_string_g():
s = """
["http://example.com/s01", "http://example.com/a", "http://example.com/Type1", "globalId", "", ""]
["http://example.com/s01", "http://example.com/label", "This is a Label", "http://www.w3.org/1999/02/22-rdf-syntax-ns#langString", "en", ""]
["http://example.com/s01", "http://example.com/comment", "This is a comment", "http://www.w3.org/2001/XMLSchema#string", "", ""]
["http://example.com/s01", "http://example.com/creationDate", "2021-12-01", "http://www.w3.org/2001/XMLSchema#date", "", ""]
["http://example.com/s01", "http://example.com/creationTime", "2021-12-01T12:13:00", "http://www.w3.org/2001/XMLSchema#dateTime", "", ""]
["http://example.com/s01", "http://example.com/age", "42", "http://www.w3.org/2001/XMLSchema#integer", "", ""]
["http://example.com/s01", "http://example.com/trueFalse", "false", ",http://www.w3.org/2001/XMLSchema#boolean", "", ""]
["http://example.com/s01", "http://example.com/op1", "http://example.com/o1", "globalId", "", ""]
["http://example.com/s01", "http://example.com/op1", "http://example.com/o2", "globalId", "", ""]
["http://example.com/s01", "http://example.com/op2", "http://example.com/o3", "globalId", "", ""]
"""
d = Graph().parse(data=s, format="hext")
assert len(d) == 10


def test_small_string():
s = """
["http://example.com/s01", "http://example.com/a", "http://example.com/Type1", "globalId", "", ""]
Expand Down
8 changes: 0 additions & 8 deletions test/test_roundtrip.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,6 @@
reason="a whole bunch of triples with bnode as subject is not in the reconstituted graph",
raises=AssertionError,
),
("json-ld", "diverse_triples.nt"): pytest.mark.xfail(
reason="the datatype is not preserved in the reconstituted graph",
raises=AssertionError,
),
("hext", "diverse_triples.nt"): pytest.mark.xfail(
reason="the datatype is not preserved in the reconstituted graph",
raises=AssertionError,
),
}

# This is for files which can only be represented properly in one format
Expand Down

0 comments on commit 372a8fc

Please sign in to comment.