readmetester

Parse, test, and assert RST code-blocks


Keywords
assert, code, readme, rst, test, python, restructuredtext
License
MIT
Install
pip install readmetester==2.4.1

Documentation

readmetester

License PyPI CI pre-commit.ci status CodeQL codecov.io readthedocs.org python3.8 Black pylint

Parse, test, and assert RST code-blocks

Installation

$ pip install readmetester

Usage

readmetester [-h] [--version] [README.rst]

If a README.rst file is present in the current working directory it will be used if no arguments are provided

$ readmetester README.rst

Documenting

Python code begins with ">>> "

Continuation lines begin with "... "

Note

The length of these strings is 4 including the whitespace at the end

Expected output can be quoted or unquoted

.. code-block:: python

    >>> n = [
    ...     "zero",
    ...     "one",
    ...     "two",
    ... ]
    >>> for c, i in enumerate(n):
    ...     print(c, i)
    0 zero
    1 one
    2 two

Styles can be configured in a pyproject.toml file

[tool.readmetester]
style = "monokai"