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: Add tests for SPARQL parsing and serialization #1810

Merged

Conversation

aucampia
Copy link
Member

@aucampia aucampia commented Apr 14, 2022

Summary of changes

This patch adds some tests for SPARQL serialization and deserialization
with checks based on round tripping where possible.

Some of these tests are expected failures in that they seem to pass fo
some parsers or serializers, but not others. If there is agreement on
what parameters should be supported we can fix the parsers and
serializers to actually support them.

There are also xfails for the handling of string paths on windows, as
this seems to fail for all serializers.

Other changes:

  • style: apply black on test/test_graph/test_graph.py and test/test_n3.py. There are no other changes to these files other than applying black, and it is done by pre-commit.ci bot.

Checklist

  • Checked that there aren't other open pull requests for
    the same change.
  • Checked that all tests and type checking passes.
  • Considered granting push permissions to the PR branch,
    so maintainers can fix minor issues and keep your PR up to date.

@aucampia
Copy link
Member Author

The most controversial thing here, and what is most in need of review, is the expected failures:

("csv", DestinationType.TEXT_IO, "utf-8"): pytest.mark.xfail(raises=TypeError),
("csv", DestinationType.TEXT_IO, "utf-16"): pytest.mark.xfail(raises=TypeError),
("json", DestinationType.TEXT_IO, "utf-8"): pytest.mark.xfail(raises=TypeError),
("json", DestinationType.TEXT_IO, "utf-16"): pytest.mark.xfail(
raises=TypeError
),
("txt", DestinationType.BINARY_IO, "utf-8"): pytest.mark.xfail(
raises=TypeError
),
("txt", DestinationType.BINARY_IO, "utf-16"): pytest.mark.xfail(
raises=TypeError
),
("txt", DestinationType.STR_PATH, "utf-8"): pytest.mark.xfail(raises=TypeError),
("txt", DestinationType.STR_PATH, "utf-16"): pytest.mark.xfail(
raises=TypeError
),

Some parsers support the encodings, and some parsers support TEXT_IO, and some support BINARY_IO. In my view all parsers should support all of them, and all of those tests should pass, so the expected failures are correct in that they denote known issues, and we can fix the issues without breaking interfaces. I'm happy to extend support once we are in agreement there.

@aucampia
Copy link
Member Author

Okay and it seems path handling completely fails on windows, adding xfails for that also, and will fix those also in a future patch.

@aucampia aucampia force-pushed the iwana-20220410T1009-sparql_result_serdes branch from 9b5ac57 to b009fc5 Compare April 14, 2022 08:39
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid stuff, useful to have.

This patch adds some tests for SPARQL serialization and deserialization
with checks based on round tripping where possible.

Some of these tests are expected failures in that they seem to pass fo
some parsers or serializers, but not others. If there is agreement on
what parameters should be supported we can fix the parsers and
serializers to actually support them.

There are also xfails for the handling of string paths on windows, as
this seems to fail for all serializers.
@aucampia aucampia force-pushed the iwana-20220410T1009-sparql_result_serdes branch from b009fc5 to 4647247 Compare April 15, 2022 09:20
@aucampia
Copy link
Member Author

pre-commit.ci autofix

@aucampia
Copy link
Member Author

rebased now onto master, two files in diff are result of pre-commit.ci applying black.

@aucampia aucampia merged commit f014e98 into RDFLib:master Apr 15, 2022
@aucampia
Copy link
Member Author

Merged as this is only adding tests, not changing any tests. The xfail marked tests also seem valid as they pass for some parsers and some operating systems. Happy to adjust them in future PRs though.

@aucampia aucampia deleted the iwana-20220410T1009-sparql_result_serdes branch May 7, 2022 09:32
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.

None yet

1 participant