ENH/TST: Doctest narrative documentation
See original GitHub issueI can’t yet claim to have any detailed oversight of the testing infrastructure of numpy, it definitely seems that a number of narrative documentations are not tested yet, e.g. here:
doc/source/reference/
.
I’ve tried to force doctest to pick up those tests, but so far it’s without much success. I got to the point with pytest-doctest
that the files are found, but for some reasons there are still deselected.
$ ~/munka/devel/numpy [doc_ma_generic L|✚ 2…1⚑ 1] $ pytest -m doctest doc/source/reference/ --doctest-rst
================================================= test session starts ==================================================
platform darwin -- Python 3.7.4, pytest-5.2.0, py-1.8.0, pluggy-0.12.0
rootdir: /Users/bsipocz/munka/devel/numpy, inifile: pytest.ini
plugins: xdist-1.29.0, forked-1.0.2, arraydiff-0.3, xonsh-0.8.3, dependency-0.4.0, remotedata-0.3.2, doctestplus-0.4.0, openfiles-0.4.0, asdf-2.4.2, cov-2.8.1, requests-mock-1.6.0
collected 89 items / 89 deselected
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
doctest — Test interactive Python examples — Python 3.11.1 ...
To perform regression testing by verifying that interactive examples from a test file or a test object work as expected. To write tutorial...
Read more >doctest — Testing Through Documentation — PyMOTW 3
It works by parsing the help text to find examples, running them, then comparing the output text against the expected value.
Read more >How To Write Doctests in Python - DigitalOcean
Ensuring that code is thoroughly documented and tested not only ensures that a program runs as expected, but also supports collaboration across ...
Read more >Things I don't like about doctest - Ned Batchelder
Python's doctest is very cool technology, letting you write a narrative in documentation that can then be executed directly to test the code...
Read more >doctest - Wikipedia
doctest is a module included in the Python programming language's standard library that allows the easy generation of tests based on output from...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Superceded by gh-14970, now that refguide-check can test snippets in RST documenation. Please reopen if I missed something.
yes, there are plenty of them, and a few issues opened about code examples that doesn’t work, e.g. here: https://docs.scipy.org/doc/numpy/reference/maskedarray.generic.html
I’m in the middle to clean up that page, but it’s just symptomatic treatment until the doctests are picking those pages up automatically