-
Notifications
You must be signed in to change notification settings - Fork 564
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: rework SPARQL test suite #1988
Merged
aucampia
merged 1 commit into
RDFLib:master
from
aucampia:iwana-20220605T1943-rework_sparql_test
Jun 8, 2022
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
""" | ||
Runs the SPARQL 1.0 test suite from. | ||
""" | ||
from test.data import TEST_DATA_DIR | ||
from test.utils import ensure_suffix | ||
from test.utils.dawg_manifest import MarksDictType, params_from_sources | ||
from test.utils.iri import URIMapper | ||
from test.utils.sparql_checker import ( | ||
SKIP_TYPES, | ||
SPARQLEntry, | ||
check_entry, | ||
ctx_configure_rdflib, | ||
) | ||
from typing import Generator | ||
|
||
import pytest | ||
from pytest import MonkeyPatch | ||
|
||
REMOTE_BASE_IRI = "http://www.w3.org/2001/sw/DataAccess/tests/data-r2/" | ||
LOCAL_BASE_DIR = TEST_DATA_DIR / "suites/w3c/dawg-data-r2/" | ||
MAPPER = URIMapper.from_mappings( | ||
(REMOTE_BASE_IRI, ensure_suffix(LOCAL_BASE_DIR.as_uri(), "/")), | ||
) | ||
MARK_DICT: MarksDictType = { | ||
f"{REMOTE_BASE_IRI}basic/manifest#term-6": pytest.mark.xfail( | ||
reason="query misinterpreted." | ||
), | ||
f"{REMOTE_BASE_IRI}basic/manifest#term-7": pytest.mark.xfail(reason="..."), | ||
f"{REMOTE_BASE_IRI}expr-builtin/manifest#dawg-datatype-2": pytest.mark.xfail( | ||
reason="additional row in output" | ||
), | ||
f"{REMOTE_BASE_IRI}open-world/manifest#date-1": pytest.mark.xfail( | ||
reason="RDFLib has more rows than it should have." | ||
), | ||
f"{REMOTE_BASE_IRI}open-world/manifest#date-2": pytest.mark.xfail( | ||
reason="RDFLib result has one too few rows." | ||
), | ||
f"{REMOTE_BASE_IRI}optional-filter/manifest#dawg-optional-filter-005-simplified": pytest.mark.xfail( | ||
reason="one row is missing a column" | ||
), | ||
f"{REMOTE_BASE_IRI}reduced/manifest#reduced-2": pytest.mark.xfail( | ||
reason="fails 2/3rds or the time" | ||
), | ||
f"{REMOTE_BASE_IRI}syntax-sparql1/manifest#syntax-bnodes-03": pytest.mark.xfail( | ||
reason="Issue with bnodes in query." | ||
), | ||
f"{REMOTE_BASE_IRI}syntax-sparql1/manifest#syntax-forms-01": pytest.mark.xfail(), | ||
f"{REMOTE_BASE_IRI}syntax-sparql1/manifest#syntax-lists-01": pytest.mark.xfail( | ||
reason="Issue with list in query." | ||
), | ||
f"{REMOTE_BASE_IRI}syntax-sparql1/manifest#syntax-lit-08": pytest.mark.skip( | ||
reason="bad test, positive syntax has invalid syntax." | ||
), | ||
f"{REMOTE_BASE_IRI}syntax-sparql2/manifest#syntax-form-describe01": pytest.mark.xfail( | ||
reason="Describe not supported." | ||
), | ||
f"{REMOTE_BASE_IRI}syntax-sparql2/manifest#syntax-general-08": pytest.mark.xfail( | ||
reason="Not parsing with no spaces." | ||
), | ||
f"{REMOTE_BASE_IRI}syntax-sparql2/manifest#syntax-lists-04": pytest.mark.xfail( | ||
reason="Not handling lists in query." | ||
), | ||
f"{REMOTE_BASE_IRI}syntax-sparql3/manifest#blabel-cross-graph-bad": pytest.mark.xfail( | ||
reason="Accepts invalid query." | ||
), | ||
f"{REMOTE_BASE_IRI}syntax-sparql3/manifest#blabel-cross-optional-bad": pytest.mark.xfail( | ||
reason="Accepts invalid query." | ||
), | ||
f"{REMOTE_BASE_IRI}syntax-sparql3/manifest#blabel-cross-union-bad": pytest.mark.xfail( | ||
reason="Accepts invalid query." | ||
), | ||
f"{REMOTE_BASE_IRI}syntax-sparql3/manifest#syn-bad-26": pytest.mark.xfail( | ||
reason="Accepts invalid query." | ||
), | ||
f"{REMOTE_BASE_IRI}syntax-sparql4/manifest#syn-bad-34": pytest.mark.xfail( | ||
reason="Accepts invalid query." | ||
), | ||
f"{REMOTE_BASE_IRI}syntax-sparql4/manifest#syn-bad-35": pytest.mark.xfail( | ||
reason="Accepts invalid query." | ||
), | ||
f"{REMOTE_BASE_IRI}syntax-sparql4/manifest#syn-bad-36": pytest.mark.xfail( | ||
reason="Accepts invalid query." | ||
), | ||
f"{REMOTE_BASE_IRI}syntax-sparql4/manifest#syn-bad-37": pytest.mark.xfail( | ||
reason="Accepts invalid query." | ||
), | ||
f"{REMOTE_BASE_IRI}syntax-sparql4/manifest#syn-bad-38": pytest.mark.xfail( | ||
reason="Accepts invalid query." | ||
), | ||
f"{REMOTE_BASE_IRI}syntax-sparql4/manifest#syn-bad-GRAPH-breaks-BGP": pytest.mark.xfail( | ||
reason="Accepts invalid query." | ||
), | ||
f"{REMOTE_BASE_IRI}syntax-sparql4/manifest#syn-bad-OPT-breaks-BGP": pytest.mark.xfail( | ||
reason="Accepts invalid query." | ||
), | ||
f"{REMOTE_BASE_IRI}syntax-sparql4/manifest#syn-bad-UNION-breaks-BGP": pytest.mark.xfail( | ||
reason="Accepts invalid query." | ||
), | ||
f"{REMOTE_BASE_IRI}syntax-sparql4/syn-bad-37.rq": pytest.mark.xfail( | ||
reason="Accepts invalid query." | ||
), | ||
} | ||
|
||
|
||
@pytest.fixture(scope="module", autouse=True) | ||
def configure_rdflib() -> Generator[None, None, None]: | ||
with ctx_configure_rdflib(): | ||
yield None | ||
|
||
|
||
@pytest.mark.parametrize( | ||
["manifest_entry"], | ||
params_from_sources( | ||
MAPPER, | ||
SPARQLEntry, | ||
LOCAL_BASE_DIR / "manifest-evaluation.ttl", | ||
LOCAL_BASE_DIR / "manifest-syntax.ttl", | ||
mark_dict=MARK_DICT, | ||
markers=( | ||
lambda entry: pytest.mark.skip(reason="tester not implemented") | ||
if entry.type in SKIP_TYPES | ||
else None, | ||
), | ||
report_prefix="rdflib_w3c_sparql10", | ||
), | ||
) | ||
def test_entry_sparql10(monkeypatch: MonkeyPatch, manifest_entry: SPARQLEntry) -> None: | ||
check_entry(monkeypatch, manifest_entry) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aucampia - whoops, looks like a citation was truncated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAICT, the relevant (resolvable) URL is
https://www.w3.org/2001/sw/DataAccess/tests/data-r2