summaryrefslogtreecommitdiff
path: root/test/test_literal
Commit message (Collapse)AuthorAgeFilesLines
* test: Eliminate flake8 errors in tests (#2353)Iwan Aucamp2023-04-141-1/+1
| | | | | | | | | | | | | | | | | | | | | 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)].
* build(deps-dev): bump black from 22.12.0 to 23.1.0 (#2248)dependabot[bot]2023-03-111-1/+0
|
* build: move to poetry for dependency management; consolidate more settings ↵Jeffrey C. Lerman2023-01-171-0/+8
| | | | | | | | | | | | | | | | | | | | | | | into pyproject.toml (#2187) Replaced setuptools with poetry which provides simpler dependency management, dependency locking and virtual environment management. This makes it easier for new developers to get a sane development environment (i.e. just `poetry install`) and also makes our CI pipeline more reproducable as now most development tools and libraries will only change through dependabot which will reduce the build failures on main and make breaking changes in dependencies more visible with dependabot PRs. Other changes: - moved isort, mypy and coverage config from setup.cfg to pyproject.toml - Changes in the generated rdflib wheel: - removed wheel extras related to development (i.e. `tests`, `docs`, `dev`) as poetry dependency groups should be used instead. - Added an extra group `lxml` with a dependency on lxml. - Added version ranges to dependencies, and tests to ensure these version ranges are valid. - Changes to tests: - Change pyparsing related tests so they work with older pyparsing. - Made the html5lib related tests conditional on html5lib existing. - Runtime changes: - Use importlib.metadata to set `__version__`. - Changed the devcontainer and related config to avoid contamination and interference with the host environment. Co-authored-by: Iwan Aucamp <aucampia@gmail.com> Co-authored-by: Edmond Chuc <edmond.chuc@outlook.com>
* fix: handling of Literal datatype (#2076)Iwan Aucamp2022-08-121-1/+73
| | | | | | | | | | | | | | | | | | Check datatype against `None` instead of checking it's truthiness (i.e. `if datatype is not None:` instead of `if datatype:`). Checking truthiness instead of `is not None` causes a blank string to be treated the same as None. The consequence of this was that `Literal.datatype` could be a `str`, a `URIRef` or `None`, instead of just a `URIRef` or `None` as was seemingly intended. Other changes: - Changed the type of `Literal.datatype` to be `Optional[URIRef]` instead of `Optional[str]` now that `str` will always be converted to `URIRef` even if it is a blank string. - Changed `rdflib.util._coalesce` to make it easier and safer to use with a non-`None` default value. - Changed `rdflib.util` to avoid issues with circular imports.
* test: convert some `unittest` based tests to `pytest` (#2075)Iwan Aucamp2022-08-072-36/+24
| | | | Fairly straight forward conversion, converted one skip to an xfail though with an explanation of what is going wrong.
* Change Literal.ill_formed to Literal.ill_typed (#2003)Alex Nelson2022-07-091-7/+7
| | | | | | | | This PR implements a rename decided on [Issue 1960](https://github.com/RDFLib/rdflib/issues/1960). References: * https://github.com/RDFLib/rdflib/issues/1960 Signed-off-by: Alex Nelson <alexander.nelson@nist.gov>
* Logging exceptions from Literal value convertersMark Watts2022-05-211-3/+38
| | | | | - Also, adding a function to reset bindings so tests are less order-dependent
* [pre-commit.ci] auto fixes from pre-commit.com hookspre-commit-ci[bot]2022-05-192-14/+14
| | | | for more information, see https://pre-commit.ci
* test: remove unused imports in test codeIwan Aucamp2022-05-172-2/+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.
* Convert test_literal.py to pytestIwan Aucamp2022-05-171-70/+74
| | | | | This is mainly to address issues experienced with flake8 in https://github.com/RDFLib/rdflib/pull/1944
* Literal datetime sub (#1870)Graham Higgins2022-05-162-38/+602
| | | | | rebased PR #1089 from 2 yrs ago, adding DateTime arithmetic operations for Literals - an extension of https://github.com/RDFLib/rdflib/issues/629, additional tests of numerics added, as requested in https://github.com/RDFLib/rdflib/pull/1089#issuecomment-666163211 and limited modernisation of `test/test_literal/test_literal.py` Co-authored-by: Iwan Aucamp <aucampia@gmail.com>
* [pre-commit.ci] auto fixes from pre-commit.com hookspre-commit-ci[bot]2022-04-157-26/+17
| | | | for more information, see https://pre-commit.ci
* Merge pull request #1773 from ashleysommer/mark_ill_typed_literalsIwan Aucamp2022-04-151-1/+60
|\ | | | | Add ability to detect and mark ill-typed literals
| * Fixes from @ajnelson-nist's reviewIwan Aucamp2022-04-141-3/+5
| |
| * Merge remote-tracking branch 'upstream/master' into mark_ill_typed_literalsIwan Aucamp2022-04-145-88/+58
| |\
| * | Merge remote-tracking branch 'upstream/master' into mark_ill_typed_literalsIwan Aucamp2022-04-121-1/+58
| | |
* | | [pre-commit.ci] auto fixes from pre-commit.com hookspre-commit-ci[bot]2022-04-143-2/+1
| |/ |/| | | | | for more information, see https://pre-commit.ci
* | take the opportunity to remove references to unittest, as suggestedGraham Higgins2022-04-125-15/+8
| |
* | fix whoopsiesGraham Higgins2022-04-121-1/+1
| |
* | migrate yet more tests to pytestGraham Higgins2022-04-125-73/+50
|/
* more test re-orgGraham Higgins2022-04-029-0/+1080