diff --git a/test/test_w3c_spec/test_n3_w3c.py b/test/test_w3c_spec/test_n3_w3c.py index 1f1506103..0048e24ef 100644 --- a/test/test_w3c_spec/test_n3_w3c.py +++ b/test/test_w3c_spec/test_n3_w3c.py @@ -4,7 +4,8 @@ import os from test import TEST_DIR from test.data import TEST_DATA_DIR -from test.utils.manifest import RDFT, RDFTest, read_manifest +from test.utils.manifest import RDFTest, read_manifest +from test.utils.namespace import RDFT from typing import Callable, Dict import pytest diff --git a/test/test_w3c_spec/test_nquads_w3c.py b/test/test_w3c_spec/test_nquads_w3c.py index e3e735e26..30a3ebef1 100644 --- a/test/test_w3c_spec/test_nquads_w3c.py +++ b/test/test_w3c_spec/test_nquads_w3c.py @@ -4,7 +4,8 @@ import os from test.data import TEST_DATA_DIR -from test.utils.manifest import RDFT, RDFTest, read_manifest +from test.utils.manifest import RDFTest, read_manifest +from test.utils.namespace import RDFT from typing import Callable, Dict import pytest diff --git a/test/test_w3c_spec/test_nt_w3c.py b/test/test_w3c_spec/test_nt_w3c.py index a9ebfb8b3..cba8104f7 100644 --- a/test/test_w3c_spec/test_nt_w3c.py +++ b/test/test_w3c_spec/test_nt_w3c.py @@ -3,7 +3,8 @@ import os from test import TEST_DIR from test.data import TEST_DATA_DIR -from test.utils.manifest import RDFT, RDFTest, read_manifest +from test.utils.manifest import RDFTest, read_manifest +from test.utils.namespace import RDFT from typing import Callable, Dict import pytest diff --git a/test/test_w3c_spec/test_trig_w3c.py b/test/test_w3c_spec/test_trig_w3c.py index f07ff9857..e534f9b3a 100644 --- a/test/test_w3c_spec/test_trig_w3c.py +++ b/test/test_w3c_spec/test_trig_w3c.py @@ -4,7 +4,8 @@ import os from test.data import TEST_DATA_DIR -from test.utils.manifest import RDFT, RDFTest, read_manifest +from test.utils.manifest import RDFTest, read_manifest +from test.utils.namespace import RDFT from typing import Callable, Dict import pytest diff --git a/test/test_w3c_spec/test_turtle_w3c.py b/test/test_w3c_spec/test_turtle_w3c.py index adea06409..67e075762 100644 --- a/test/test_w3c_spec/test_turtle_w3c.py +++ b/test/test_w3c_spec/test_turtle_w3c.py @@ -5,7 +5,8 @@ from pathlib import Path from test.data import TEST_DATA_DIR from test.utils import file_uri_to_path -from test.utils.manifest import RDFT, RDFTest, read_manifest +from test.utils.manifest import RDFTest, read_manifest +from test.utils.namespace import RDFT from typing import Callable, Dict, Set import pytest diff --git a/test/utils/_EARL.py b/test/utils/_EARL.py new file mode 100644 index 000000000..9d3dd970c --- /dev/null +++ b/test/utils/_EARL.py @@ -0,0 +1,42 @@ +from rdflib.namespace import DefinedNamespace, Namespace +from rdflib.term import URIRef + + +class EARL(DefinedNamespace): + _fail = True + _NS = Namespace("http://www.w3.org/ns/earl#") + + assertedBy: URIRef # assertor of an assertion + Assertion: URIRef # a statement that embodies the results of a test + Assertor: URIRef # an entity such as a person, a software tool, an organization, or any other grouping that carries out a test collectively + automatic: URIRef # where the test was carried out automatically by the software tool and without any human intervention + CannotTell: URIRef # the class of outcomes to denote an undetermined outcome + cantTell: URIRef # it is unclear if the subject passed or failed the test + failed: URIRef # the subject failed the test + Fail: URIRef # the class of outcomes to denote failing a test + inapplicable: URIRef # the test is not applicable to the subject + info: URIRef # additional warnings or error messages in a human-readable form + mainAssertor: URIRef # assertor that is primarily responsible for performing the test + manual: URIRef # where the test was carried out by human evaluators + mode: URIRef # mode in which the test was performed + NotApplicable: URIRef # the class of outcomes to denote the test is not applicable + NotTested: URIRef # the class of outcomes to denote the test has not been carried out + outcome: URIRef # outcome of performing the test + OutcomeValue: URIRef # a discrete value that describes a resulting condition from carrying out the test + passed: URIRef # the subject passed the test + Pass: URIRef # the class of outcomes to denote passing a test + pointer: URIRef # location within a test subject that are most relevant to a test result + result: URIRef # result of an assertion + semiAuto: URIRef # where the test was partially carried out by software tools, but where human input or judgment was still required to decide or help decide the outcome of the test + Software: URIRef # any piece of software such as an authoring tool, browser, or evaluation tool + subject: URIRef # test subject of an assertion + TestCase: URIRef # an atomic test, usually one that is a partial test for a requirement + TestCriterion: URIRef # a testable statement, usually one that can be passed or failed + TestMode: URIRef # describes how a test was carried out + TestRequirement: URIRef # a higher-level requirement that is tested by executing one or more sub-tests + TestResult: URIRef # the actual result of performing the test + TestSubject: URIRef # the class of things that have been tested against some test criterion + test: URIRef # test criterion of an assertion + undisclosed: URIRef # where the exact testing process is undisclosed + unknownMode: URIRef # where the testing process is unknown or undetermined + untested: URIRef # the test has not been carried out diff --git a/test/utils/_RDFT.py b/test/utils/_RDFT.py new file mode 100644 index 000000000..be7eacfa9 --- /dev/null +++ b/test/utils/_RDFT.py @@ -0,0 +1,38 @@ +from rdflib.namespace import DefinedNamespace, Namespace +from rdflib.term import URIRef + + +class RDFT(DefinedNamespace): + """ + Described at . + Generated from . + """ + + _fail = True + _NS = Namespace("http://www.w3.org/ns/rdftest#") + + approval: URIRef # Approval status of a test. + Approval: URIRef # The superclass of all test approval statuses. + Approved: URIRef # Indicates that a test is approved. + Proposed: URIRef # Indicates that a test is proposed, but not approved. + Rejected: URIRef # Indicates that a test is not approved. + TestEval: URIRef # Superclass of all RDF Evaluation Tests. + TestNQuadsNegativeSyntax: URIRef # A negative N-Quads syntax test. + TestNQuadsPositiveSyntax: URIRef # A positive N-Quads syntax test. + TestNTriplesNegativeSyntax: URIRef # A negative N-Triples syntax test. + TestNTriplesPositiveSyntax: URIRef # A positive N-Triples syntax test. + TestSyntax: URIRef # Superclass of all RDF Syntax Tests. + TestTrigEval: URIRef # A positive TriG evaluation test. + TestTrigNegativeEval: URIRef # A negative TriG evaluation test. + TestTriGNegativeSyntax: URIRef # A negative TriG syntax test. + TestTriGPositiveSyntax: URIRef # A positive TriG syntax test. + TestTurtleEval: URIRef # A positive Turtle evaluation test. + TestTurtleNegativeEval: URIRef # A negative Turtle evaluation test. + TestTurtleNegativeSyntax: URIRef # A negative Turtle syntax test. + TestTurtlePositiveSyntax: URIRef # A positive Turtle syntax test. + Test: URIRef # Superclass of all RDF Tests. + TestXMLNegativeSyntax: URIRef # A negative RDF/XML syntax test. + XMLEval: URIRef # A positive RDF/XML evaluation test. + + TestTrigPositiveSyntax: URIRef + TestTrigNegativeSyntax: URIRef diff --git a/test/utils/earl.py b/test/utils/earl.py index e44480bb2..441a3e860 100644 --- a/test/utils/earl.py +++ b/test/utils/earl.py @@ -5,7 +5,7 @@ import logging from datetime import datetime from pathlib import Path -from test.utils.manifest import RDFT +from test.utils.namespace import EARL, RDFT from typing import TYPE_CHECKING, Generator, Optional, Tuple, cast import pytest @@ -23,46 +23,6 @@ from pluggy._result import _Result -class EARL(DefinedNamespace): - _fail = True - _NS = Namespace("http://www.w3.org/ns/earl#") - - assertedBy: URIRef # assertor of an assertion - Assertion: URIRef # a statement that embodies the results of a test - Assertor: URIRef # an entity such as a person, a software tool, an organization, or any other grouping that carries out a test collectively - automatic: URIRef # where the test was carried out automatically by the software tool and without any human intervention - CannotTell: URIRef # the class of outcomes to denote an undetermined outcome - cantTell: URIRef # it is unclear if the subject passed or failed the test - failed: URIRef # the subject failed the test - Fail: URIRef # the class of outcomes to denote failing a test - inapplicable: URIRef # the test is not applicable to the subject - info: URIRef # additional warnings or error messages in a human-readable form - mainAssertor: URIRef # assertor that is primarily responsible for performing the test - manual: URIRef # where the test was carried out by human evaluators - mode: URIRef # mode in which the test was performed - NotApplicable: URIRef # the class of outcomes to denote the test is not applicable - NotTested: URIRef # the class of outcomes to denote the test has not been carried out - outcome: URIRef # outcome of performing the test - OutcomeValue: URIRef # a discrete value that describes a resulting condition from carrying out the test - passed: URIRef # the subject passed the test - Pass: URIRef # the class of outcomes to denote passing a test - pointer: URIRef # location within a test subject that are most relevant to a test result - result: URIRef # result of an assertion - semiAuto: URIRef # where the test was partially carried out by software tools, but where human input or judgment was still required to decide or help decide the outcome of the test - Software: URIRef # any piece of software such as an authoring tool, browser, or evaluation tool - subject: URIRef # test subject of an assertion - TestCase: URIRef # an atomic test, usually one that is a partial test for a requirement - TestCriterion: URIRef # a testable statement, usually one that can be passed or failed - TestMode: URIRef # describes how a test was carried out - TestRequirement: URIRef # a higher-level requirement that is tested by executing one or more sub-tests - TestResult: URIRef # the actual result of performing the test - TestSubject: URIRef # the class of things that have been tested against some test criterion - test: URIRef # test criterion of an assertion - undisclosed: URIRef # where the exact testing process is undisclosed - unknownMode: URIRef # where the testing process is unknown or undetermined - untested: URIRef # the test has not been carried out - - class EarlReport: """ This is a helper class for building an EARL report graph. diff --git a/test/utils/manifest.py b/test/utils/manifest.py index abaaf551b..abdaea624 100644 --- a/test/utils/manifest.py +++ b/test/utils/manifest.py @@ -1,3 +1,4 @@ +from test.utils.namespace import RDFT from typing import Iterable, List, NamedTuple, Optional, Tuple, Union, cast from rdflib import RDF, RDFS, Graph, Namespace @@ -9,37 +10,6 @@ UP = Namespace("http://www.w3.org/2009/sparql/tests/test-update#") -class RDFT(DefinedNamespace): - _fail = True - _NS = Namespace("http://www.w3.org/ns/rdftest#") - - approval: URIRef # Approval status of a test. - Approval: URIRef # The superclass of all test approval statuses. - Approved: URIRef # Indicates that a test is approved. - Proposed: URIRef # Indicates that a test is proposed, but not approved. - Rejected: URIRef # Indicates that a test is not approved. - TestEval: URIRef # Superclass of all RDF Evaluation Tests. - TestNQuadsNegativeSyntax: URIRef # A negative N-Quads syntax test. - TestNQuadsPositiveSyntax: URIRef # A positive N-Quads syntax test. - TestNTriplesNegativeSyntax: URIRef # A negative N-Triples syntax test. - TestNTriplesPositiveSyntax: URIRef # A positive N-Triples syntax test. - TestSyntax: URIRef # Superclass of all RDF Syntax Tests. - TestTrigEval: URIRef # A positive TriG evaluation test. - TestTrigNegativeEval: URIRef # A negative TriG evaluation test. - TestTriGNegativeSyntax: URIRef # A negative TriG syntax test. - TestTriGPositiveSyntax: URIRef # A positive TriG syntax test. - TestTurtleEval: URIRef # A positive Turtle evaluation test. - TestTurtleNegativeEval: URIRef # A negative Turtle evaluation test. - TestTurtleNegativeSyntax: URIRef # A negative Turtle syntax test. - TestTurtlePositiveSyntax: URIRef # A positive Turtle syntax test. - Test: URIRef # Superclass of all RDF Tests. - TestXMLNegativeSyntax: URIRef # A negative RDF/XML syntax test. - XMLEval: URIRef # A positive RDF/XML evaluation test. - - TestTrigPositiveSyntax: URIRef - TestTrigNegativeSyntax: URIRef - - DAWG = Namespace("http://www.w3.org/2001/sw/DataAccess/tests/test-dawg#") ResultType = Union[Identifier, Tuple[Identifier, List[Tuple[Identifier, Identifier]]]] diff --git a/test/utils/namespace.py b/test/utils/namespace.py new file mode 100644 index 000000000..e52cd70b4 --- /dev/null +++ b/test/utils/namespace.py @@ -0,0 +1,7 @@ +from ._EARL import EARL +from ._RDFT import RDFT + +__all__ = [ + "EARL", + "RDFT", +]