Skip to content

Commit

Permalink
Merge pull request #33 from iolanta-tech/32-ttn01
Browse files Browse the repository at this point in the history
32 ttn01
  • Loading branch information
anatoly-scherbakov authored Mar 30, 2024
2 parents 30cee6b + d47c33f commit c724a1e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions ldtest/sparql/tests.sparql
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@ SELECT ?test ?result ?input ?req ?extract_all_scripts WHERE {
FILTER NOT EXISTS {
?test jld:option / jld:specVersion "json-ld-1.0"^^xsd:string .
}

FILTER NOT EXISTS {
?test jld:option / jld:processingMode "json-ld-1.0"^^xsd:string .
}
}
12 changes: 9 additions & 3 deletions tests/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from documented import Documented

from ldtest.models import TestCase
from yaml_ld.models import Document


Expand All @@ -12,18 +13,23 @@ class FailureToFail(Documented):
YAMLLDError not raised.
Expected error code: {self.expected_error_code}
Raw input document: {self.formatted_raw_document}
Expanded document: {self.formatted_expanded_document}
Raw input document (from {self.test_case.input}):
{self.formatted_raw_document}
Expanded document:
{self.formatted_expanded_document}
"""

test_case: TestCase
expected_error_code: str
raw_document: bytes
expanded_document: Document

@property
def formatted_raw_document(self) -> str:
"""Present the raw document."""
return str(self.raw_document)
return self.raw_document.decode()

@property
def formatted_expanded_document(self) -> str:
Expand Down
2 changes: 2 additions & 0 deletions tests/test_specification.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def test_to_rdf(test_case: TestCase):

else:
pytest.fail(str(FailureToFail(
test_case=test_case,
expected_error_code=test_case.result,
raw_document=test_case.raw_document,
expanded_document=rdf_document,
Expand Down Expand Up @@ -76,6 +77,7 @@ def test_expand(test_case: TestCase):
assert error.code == test_case.result
else:
pytest.fail(str(FailureToFail(
test_case=test_case,
expected_error_code=test_case.result,
raw_document=test_case.raw_document,
expanded_document=expanded_document,
Expand Down

0 comments on commit c724a1e

Please sign in to comment.