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"
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.1.0.tar.gz
(9.5 kB
view hashes)
Built Distribution
Close
Hashes for readmetester-2.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b55c44fa54b09184f555785e724d8f0fd5dbc8aeb59f747b573940bdea01fc0 |
|
MD5 | 00ed878fac314f0a6c327bfe359a3576 |
|
BLAKE2b-256 | b2da800338e2274d47e5e43f38a49a7121550cdaf600e6f14ba551f2237d0693 |