| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Eliminate some occurrences of the following flake8 errors in tests:
* E265 block comment should start with '# '
* E266 too many leading '#' for block comment
* E402 module level import not at top of file
* E712 comparison to False should be 'if cond is False:' or 'if not cond:'
* E712 comparison to True should be 'if cond is True:' or 'if cond:'
* E722 do not use bare 'except'
* F401 ... imported but unused
* F403 ... used; unable to detect undefined names
* F405 ... may be undefined, or defined from star imports: ...
* F541 f-string is missing placeholders
* F841 local variable 'result' is assigned to but never used
* N806 variable 'TEST_DIR' in function should be lowercase
This is pursuant to eliminating
[flakeheaven](https://github.com/flakeheaven/flakeheaven), as it no longer
supports the latest version of flake8
[[ref](https://github.com/flakeheaven/flakeheaven/issues/132)].
|
| |
|
|
|
|
|
|
| |
Disable
[`implicit_reexport`](https://mypy.readthedocs.io/en/stable/config_file.html#confval-implicit_reexport)
and eliminate all errors reported by mypy after this.
This helps ensure that import statements import from the right module and that
the `__all__` variable is correct.
|
| |
|
|
|
|
|
|
|
|
| |
`Context.to_dict` is used in JSON-LD serialization, but it was not implemented.
This change adds the method.
- Closes <https://github.com/RDFLib/rdflib/issues/2138>.
---------
Co-authored-by: Marc-Antoine Parent <maparent@acm.org>
|
| |
|
|
|
|
|
|
|
|
| |
A variable was only being initialized for string-valued inputs, but if a `dict`
input was passed the variable would still be accessed, resulting in a
`UnboundLocalError`.
This change initializes the variable always, instead of only when string-valued
input is used to construct a JSON-LD context.
- Closes <https://github.com/RDFLib/rdflib/issues/2303>.
|
| |
|
|
|
|
|
|
|
|
|
| |
This is being done so that it is easier for downstream packagers to run the test
suite without requiring internet access.
To run only tests that does not use the internet, run `pytest -m "not webtest"`.
The validation workflow validates that test run without internet access by
running the tests inside `firejail --net=none`.
- Closes <https://github.com/RDFLib/rdflib/issues/2293>.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
The the base URI passed to _prep_sources was being overwritten in anticipation of processing inner nestings, but this caused problems when processing multiple inputs. Changed the assignment to `base` to `new_base`.
|
| |
|
|
| |
`flake8` will eventually complain about this when the `flakeheaven` baseline
is invalidated.
|
| |
|
|
|
|
|
|
|
| |
Not the most straight forward conversion, but it simplifies it somewhat.
Main reason for doing this is to remove the use of `unittest` `subTest` as
we need `pytest-subtest` to process that with `pytest` and that dependency
is causing some complications in dependency solving for pip sometimes.
Merged with one review as this has no runtime impact.
|
| |
|
|
| |
for more information, see https://pre-commit.ci
|
| |
|
|
|
|
|
|
| |
This is being done because `rdlib.net` is a typo and `rdflib.net` is not owned or associated with this project.
Also:
- Expand testing for some parts of the code impacted by this.
Co-authored-by: Iwan Aucamp <aucampia@gmail.com>
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
| |
for more information, see https://pre-commit.ci
|
| |
|
|
| |
for more information, see https://pre-commit.ci
|
| |\ |
|
| | |
| |
| |
| |
| |
| |
| |
| | |
Also removed mypy config to ignore errors in tests.
This will make tests useful for determining if the typing of rdflib is
correct and sane and should also help detect if a change in rdflib
introduces typing errors in tests.
|
| |\ \
| |/ |
|
| | |\
| | |
| | | |
guess_format() cater for JSON-LD files ending .json-ld
|
| | | | |
|
| | |\ \
| | | |
| | | | |
RFC: Add PythonInputSource to create py-based graphs
|
| | | |\ \
| | | |/ |
|
| | | | | |
|
| | | | | |
|
| | | | | |
|
| | | | | |
|
| | | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
In order to manipulate a JSON-LD structure before creating
a graph (specifically to simplify rdf:Seq handling), it is
currently necessary to use `json.loads` followed by `dumps`
and then let `Graph().parse()` re-load. By detecting `dict`
instances and creating a `PythonInputSource`, a single call
to `loads` suffices.
|
| | | |/
| |/|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
In rdflib:
- Fix rdflib.plugins.shared.jsonld.util.norm_url on Windows
On windows normpath and sep is not appropriate for URLs, use posixpath
so that the behaviour is consistent.
- Fix handling of file URIs in Graph.serialize on windows
Should use url2pathname(path) to get a path from the path segment of
URLs
In tests:
- Fix handling of file created by mkstemp
Should first call os.close on the OS-level handle before removing the
file.
- Fix how file URIs are created so they work properly on windows.
- Skip tests which are sensitive to unicode normalization and carriage
return as these do not pass on windows (about 5 tests).
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
test/jsonld/test_onedotone.py got a bit messed up with a merge from
master. Looking at the original changes from @ashleysommer, all he did
was change a condition. This applies the same change but essentially
rebased on master.
For comparison see: https://github.com/RDFLib/rdflib/compare/ab31c5ed3772cb63806a4614ca4431e9bd7de8d3...c4b679ff6660f4287e7738c93c8c06072642ce1a
Also add back import os in rdflib/parser.py
This is now needed after https://github.com/RDFLib/rdflib/pull/1441 was
merged.
|
| | | |
| | |
| | | |
Co-authored-by: Christian Clauss <cclauss@me.com>
|
| | | |
| | |
| | | |
Co-authored-by: Christian Clauss <cclauss@me.com>
|
| | | |
| | |
| | | |
Co-authored-by: Christian Clauss <cclauss@me.com>
|
| |\ \ \
| |/ / |
|
| | |\ \
| | | |
| | | | |
Fix JSON-LD data import adds trailing slashes to IRIs (#1443)
|
| | | | |
| | | |
| | | |
| | | | |
Tests suggested by @newinnovations.
|
| | | |/ |
|
| | |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This patch replace all uses of nose with pytest. It also includes a
pytest plugin for creating EARL reports for tests with a `rdf_test_uri`
parameter.
Some caveats:
- HTML report directory is now htmlcov instead of coverage
- There is some warning related to the EARL reporting plugin which I can't quite figure out:
```
.venv/lib64/python3.7/site-packages/_pytest/config/__init__.py:676
/home/iwana/sw/d/github.com/iafork/rdflib/.venv/lib64/python3.7/site-packages/_pytest/config/__init__.py:676: PytestAssertRewriteWarning: Module already imported so cannot be rewritten: test.earl
self.import_plugin(import_spec)
```
This is not causing any problems as far as I can tell, but still annoying.
- python setup.py test won't work anymore, I can make it work but this
is not advised by pytest:
https://github.com/pytest-dev/pytest-runner/#deprecation-notice
- run_test.py is still there but it's not really referenced anymore from
anywhere and the options it accepts are completely different as it's options
were based on nose. I would say it should be removed entirely but for now
it is basically just a wrapper around pytest that basically does nothing.
- Removed references to test attributes as currently they are not being
used anywhere anyway, I guess we can add them back if there is some
use for them later.
- A lot of tests are still marked to skip when really they should be marked
with xfail. This is also affecting the RDFT test manifests and result in
reports saying tests are skipped when really we know they will fail and
they are only skipped for this reason. But there is no change here from
before, and pytest makes it easier to dynamically do expected failures.
Special thanks to Wes Turner for his advice and inputs on this process.
|
| |/
|
|
|
|
| |
of HTTP responses. Use Links to resolve schema.org-style json-ld conneg redirections.
Fix the ability to run the `remote-url` arm of the JSON-LD test suite (got most of them working!)
|
| | |
|
| |
|
|
| |
it when done
|
| | |
|
| | |
|
| | |
|
| |
|