Parse, test, and assert RST code-blocks
Project description
Parse and test README.rst Python code-blocks
Installation
$ pip install readmetester
Code blocks need to begin with
.. code-block:: python
followed by a blank line
End a code block with another blank line
Usage
readmetester [-h] file
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
Documented code needs to be indented
Python code begins with ">>> "
Expected output can be single quoted or unquoted (no double quotes)
.. code-block:: python
>>> print("Hello, world!")
'Hello, world!'
Continuation lines begin with "... "
.. 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"
Using readmetester API
>>> import readmetester
>>> readmetester.main()
'recursive exec not implemented'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
readmetester-2.2.0.tar.gz
(11.0 kB
view hashes)
Built Distribution
Close
Hashes for readmetester-2.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a67b0299de899f4240a509e550bff42c979f6391f348a73cf0fb487bae98a1f7 |
|
MD5 | 3d809fb979450ee4a937a2b5c9562637 |
|
BLAKE2b-256 | b7e3531e1b46813b7193040a7d1541b526e513db78d2f2081532e26f07982e30 |