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

Don't update SUFFIX_FORMAT_MAP in plugins/parsers/jsonld.py #1652

Conversation

aucampia
Copy link
Member

@aucampia aucampia commented Jan 8, 2022

jsonld will already be in SUFFIX_FORMAT_MAP, so the code being
removed here should have no effect.

There are already tests for this and the tests would fail of the removed
code did anything, see:

def test_guess_format(self) -> None:
self.assertEqual(guess_format("example.trix"), "trix")
self.assertEqual(guess_format("local-file.jsonld"), "json-ld")
self.assertEqual(guess_format("local-file.json-ld"), "json-ld")
self.assertEqual(guess_format("/some/place/on/disk/example.json"), "json-ld")
self.assertEqual(guess_format("../../relative/place/on/disk/example.json"), "json-ld")
self.assertEqual(guess_format("example.rdf"), "xml")
self.assertEqual(guess_format("example.nt"), "nt")
self.assertEqual(guess_format("example.n3"), "n3")
self.assertIsNone(guess_format("example.docx", None))
self.assertIsNone(guess_format("example", None))
self.assertIsNone(guess_format("example.mkv", None))

`jsonld` will already be in `SUFFIX_FORMAT_MAP`, so the code being
removed here should have no effect.

There are already tests for this and the tests would fail of the removed
code did anything, see:

https://github.com/RDFLib/rdflib/blob/b2fdaf5a1f45c09694dbd8925ab6b6dee84436b4/test/test_parse_file_guess_format.py#L23-L34
Copy link
Member

@niklasl niklasl left a comment

Choose a reason for hiding this comment

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

LGTM! (This was just a hack done by rdflib-jsonld when it was an external package.)

@nicholascar nicholascar self-requested a review January 9, 2022 15:05
Copy link
Member

@nicholascar nicholascar left a comment

Choose a reason for hiding this comment

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

Good tidy-up

@nicholascar nicholascar merged commit 1ba0860 into RDFLib:master Jan 9, 2022
@aucampia aucampia deleted the iwana-20220108T1634-dont_change_suffix_map branch April 9, 2022 14:15
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

3 participants