summaryrefslogtreecommitdiff
path: root/test/test_graph/test_variants.py
Commit message (Collapse)AuthorAgeFilesLines
* fix: small InputSource related issues (#2255)Iwan Aucamp2023-03-111-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | I have added a bunch of tests for `InputSource` handling, checking most kinds of input source with most parsers. During this, I detected the following issues that I fixed: - `rdflib.util._iri2uri()` was URL quoting the `netloc` parameter, but this is wrong and the `idna` encoding already takes care of special characters. I removed the URL quoting of `netloc`. - HexTuple parsing was handling the input source in a way that would only work for some input sources, and not raising errors for other input sources. I changed the input source handling to be more generic. - `rdflib.parser.create_input_source()` incorrectly used `file.buffer` instead of `source.buffer` when dealing with IO stream sources. Other changes with no runtime impact include: - Changed the HTTP mocking stuff in test slightly to accommodate serving arbitrary files, as I used this in the `InputSource` tests. - Don't use Google in tests, as we keep getting `urllib.error.HTTPError: HTTP Error 429: Too Many Requests` from it.
* fix: always parse HexTuple files as utf-8 (#2070)Iwan Aucamp2022-08-071-11/+0
| | | | | | | | | | Always parse HexTuple files as utf-8 as was the intent anyway as evidenced by the code that will raise a warning if the encoding provided for a HexTuple file is something other than utf-8 or None. https://github.com/RDFLib/rdflib/blob/cfa418074b27b12aac905ba266b002a237c5ff4c/rdflib/plugins/parsers/hext.py#L73-L79 Not adding any tests as this code is already tested and an XFAIL is removed in this patch.
* Add tests demonstrating forward-slash behaviors in Turtle, JSON-LD, and ↵Alex Nelson2022-05-181-0/+14
| | | | | | | | | | | SPARQL (#1872) This patch adds test to verify that forward-slashes, and escaped forward slashes, work correctly in Turtle, JSON-LD and SPARQL. Some of the added tests check that SPARQL queries that contain seemingly escaped forward slashes as part of `PN_LOCAL` fail to execute as the SPARQL spec does not allow for escaped forward slashes in `PN_LOCAL`. Currently the RDFLib SPARQL processor does however allow escaped forward slashes as part of `PN_LOCAL`, so these tests have been marked with xfail as RDFLib should provide some way to parse SPARQL in strict mode, and in this mode leaniancies should be disabled and any non-standard SPARQL should be treated as invalid. Co-authored-by: Iwan Aucamp <aucampia@gmail.com>
* test: remove unused imports in test codeIwan Aucamp2022-05-171-1/+1
| | | | | | | | | | This patch removes unused imports in test code. This is mainly to remove the potential snag for flake8/flakeheaven. The actual cleanup was done with `pycln --all test`. Also: - Remove superflous `pass` statements.
* test: add more graph variants highlighting bugsIwan Aucamp2022-05-121-0/+23
| | | | | | | | | | | | | | | This patch adds some additional graph variants: - diverse_triples: More than one triple using various features. - diverse_quads: More than one quad in more than one graph using various features. - more_quads: Simple quads in more than one graph. This also highlights some additional issues: - There is a bug in JSON-LD and HexTuple serialization that drops datatypes. - The TriG parser gets confused about what graph a quad is in. - There is some encoding related issue with HexTuple parsing on windows.
* test: move test utility modules into `test/utils/` (#1879)Iwan Aucamp2022-05-041-1/+1
| | | | | | | This patch moves all test utility modules into `test/utils/` and the tests for these modules into `test/utils/test/`. This is to make test utilities more organized and in preparation for adding more test utilities related to test suites.
* test: move `test/variants` into `test/data`Iwan Aucamp2022-04-231-2/+3
| | | | This is to bring it in line with other test data.
* [pre-commit.ci] auto fixes from pre-commit.com hookspre-commit-ci[bot]2022-04-141-2/+8
| | | | for more information, see https://pre-commit.ci
* Add two xfails related to Example 2 from RDF 1.1 TriG specificationIwan Aucamp2022-04-111-5/+35
| | | | | | | | | | | | | | | | | | | | | | | The first xfail occurs during round tripping, TriG seems to be making some mistake when encoding blank nodes, as it is encoding that "Bob" knows someone who does not exist. This was reported by @gjhiggins in https://github.com/RDFLib/rdflib/pull/1796#discussion_r846781069 The second xfail seems to be related to hextuple parsing, when comparing the hextuple parsed result of Example 2 with the TriG parsed graph of Example 2 the graphs are not isomorphic more than 70% of the time, but sometimes they are isomorphic. Inoticed this while adding the xfail for the issue @gjhiggins noticed. Other changes: - Added `simple_quad` to variants tests with HexTuple and TriG format. - Added an additional exact_match assert for variants which can be used to sidestep some of the known issues with isomorphic graph detection. This is useful for graphs with no BNodes. - Also added round-tripping for `variants/simple_quad.trig`. - Various changes to ensure determensitic ordering so that it is easier to compare things visually and so that tests always do the exact same thing in the exact same order.
* more test re-orgGraham Higgins2022-04-021-0/+182