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

Prevent from_n3 from unescaping \xhh #1343

Merged
merged 1 commit into from
Jul 2, 2021

Conversation

aucampia
Copy link
Member

This is a fairly pragmatic fix to a problem which should be solved by
changing from_n3 to do the same as the actual n3/turtle parser.

There are still many issues with this function, some of which I added
tests for.

If someone wants me to only submit the tests with expecturedFailure let me know.

Fixes #549

Proposed Changes

  • Escape '\x' in strings to from_n3 to prevent .decode("unicode-escape") from un-escaping it.
  • Add additional expecturedFailure test for some known failures which remain after this specific issue is fixed.

@nicholascar
Copy link
Member

So it looks like this change is actually passing all tests and that the failure is the dreaded and erroneous "Cannot assign requested address". @aucampia I thought your MockServer work overcame that false error?

@aucampia
Copy link
Member Author

aucampia commented Jun 26, 2021

@nicholascar all test should pass, I just meant, the fix here is maybe not really worth that much given the other problems with the function, so just merging the tests here without the fix could make sense, but I guess reducing the amount of potential problems with the function is not a bad thing either.

The OSError: [Errno 99] Cannot assign requested address is coming from the test that still use DBPedia directly (here).

From logs:

1804	Traceback (most recent call last):
1805	  File "/drone/src/test/test_sparqlstore.py", line 50, in test_Query
1806	    res = helper.query_with_retry(self.graph, query, initNs={})
1807	  File "/drone/src/test/helper.py", line 41, in query_with_retry
1808	    result = graph.query(query, **kwargs)

The last 6 spurious test failures before this also all came from this DBPedia tests, and I'm sure more, just have not checked.

I think replacing the DBPedia test with the mock server should help alleviate these problems.

I will make an issue and have a look at it when I have time.

This is a fairly pragmatic fix to a problem which should be solved by
changing `from_n3` to do the same as the actual n3/turtle parser.

There are still many issues with this function, some of which I added
tests for.
@aucampia
Copy link
Member Author

aucampia commented Jun 26, 2021

Created an issue for the spurious test failures related to DBPedia: #1344

@nicholascar nicholascar merged commit f149883 into RDFLib:master Jul 2, 2021
@aucampia aucampia deleted the iwana-issue549 branch November 17, 2021 19:29
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.

from_n3 erroneously unescapes \xhh
2 participants