Skip to content

Commit

Permalink
Fixed expand-manifest#t0089 I hope
Browse files Browse the repository at this point in the history
  • Loading branch information
anatoly-scherbakov committed Apr 24, 2024
1 parent c0109a3 commit 151c06b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions ldtest/facets.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def show(self) -> Iterable[TestCase]:
result=self._process_result(row['result']),
req=(req := row.get('req')) and req.value,
extract_all_scripts=extract_all_scripts,
base=row.get('base'),
)

def _process_result(
Expand Down
1 change: 1 addition & 0 deletions ldtest/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class TestCase:
result: Path | str | Exception # noqa: WPS110
req: str
extract_all_scripts: bool = False
base: str | None = None

@property
def raw_document(self) -> bytes:
Expand Down
6 changes: 5 additions & 1 deletion ldtest/sparql/tests.sparql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SELECT ?test ?result ?input ?req ?extract_all_scripts WHERE {
SELECT ?test ?result ?input ?req ?extract_all_scripts ?base WHERE {
?test
a $test_class ;
mf:result ?result ;
Expand All @@ -12,6 +12,10 @@ SELECT ?test ?result ?input ?req ?extract_all_scripts WHERE {
?test jld:option / jld:extractAllScripts ?extract_all_scripts .
}

OPTIONAL {
?test jld:option / jld:base ?base .
}

# FIXME: We mimic how `pyld` tests work, skipping 1.0 tests. This is probably incorrect though.
FILTER NOT EXISTS {
?test jld:option / jld:specVersion "json-ld-1.0"^^xsd:string .
Expand Down
2 changes: 2 additions & 0 deletions tests/test_specification.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ def test_expand(test_case: TestCase):
actual = yaml_ld.expand(
test_case.input,
extract_all_scripts=test_case.extract_all_scripts,
base=test_case.base,
)

if actual != expected:
# Try running `pyld` against this example.
jsonld_actual = jsonld.expand(json.loads(test_case.result.read_text()))
Expand Down

0 comments on commit 151c06b

Please sign in to comment.