Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: move EARL and RDFT namespaces to separate files #1931

Merged
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
3 changes: 2 additions & 1 deletion test/test_w3c_spec/test_n3_w3c.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion test/test_w3c_spec/test_nquads_w3c.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion test/test_w3c_spec/test_nt_w3c.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion test/test_w3c_spec/test_trig_w3c.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion test/test_w3c_spec/test_turtle_w3c.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
42 changes: 42 additions & 0 deletions test/utils/_EARL.py
Original file line number Diff line number Diff line change
@@ -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
38 changes: 38 additions & 0 deletions test/utils/_RDFT.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from rdflib.namespace import DefinedNamespace, Namespace
from rdflib.term import URIRef


class RDFT(DefinedNamespace):
"""
Described at <https://www.w3.org/ns/rdftest#>.
Generated from <https://www.w3.org/ns/rdftest.ttl>.
"""

_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
42 changes: 1 addition & 41 deletions test/utils/earl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
32 changes: 1 addition & 31 deletions test/utils/manifest.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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]]]]
Expand Down
7 changes: 7 additions & 0 deletions test/utils/namespace.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from ._EARL import EARL
from ._RDFT import RDFT

__all__ = [
"EARL",
"RDFT",
]