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

Add tests for issue #1299 #1328

Merged
merged 1 commit into from
Jun 18, 2021
Merged

Conversation

aucampia
Copy link
Member

These tests confirm that bound namespaces occur
exactly once in SPARQL queries when using SPARQLStore.

Closes #1299 (Issue does not exist, this just adds tests to confirm it does not exists)

Proposed Changes

  • Check that query argument to rdflib.plugins.stores.sparqlstore.SPARQLConnector.query contains bound namespaces exactly once.
  • Add Mock HTTP server based tests for queries to SPARQLStore that confirms the query send to the server contains bound namespaces exactly once.

I think the mock server based test is better, and ideally this should replace all the test that queries http://dbpedia.org/sparql, but it adds about 0.5 seconds to tests as it stands, so maybe it is not ideal. If you want only one of the two approaches let me know and I will remove the other.

@aucampia aucampia force-pushed the issue1299_tests branch 2 times, most recently from c9d6e35 to 98d0b49 Compare May 24, 2021 19:41
@coveralls
Copy link

coveralls commented May 24, 2021

Coverage Status

Coverage decreased (-0.08%) to 75.627% when pulling 9659a2e on iafork:issue1299_tests into 06df8b6 on RDFLib:master.

These tests confirm that bound namespaces occur
exactly once in SPARQL queries when using SPARQLStore.
@nicholascar
Copy link
Member

This looks really great: we have to do something about our testing dependency on DBPedia and others, so having a mock server set up here could likely be the pattern we want to use for all SPARQL testing.

I'll review this properly over the weekend (looks good anyway) and see if I can reuse the pattern for a couple of other tests. If so, I'll try and assess how widely this pattern can apply and what utility functions we might make for multiple test to use.

Again @aucampia, thanks for the great work here!

@nicholascar nicholascar merged commit 8048f37 into RDFLib:master Jun 18, 2021
@aucampia aucampia deleted the issue1299_tests branch November 17, 2021 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SPARQLStore queries contain multiple definitions of standard prefixes
4 participants