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
Built Distribution
File details
Details for the file readmetester-2.2.0.tar.gz
.
File metadata
- Download URL: readmetester-2.2.0.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.8.11+ Linux/5.16.11-200.fc35.x86_64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 564692dee6bbe99f13c750b39e5043109cd9c3a3e8296e4838c688f67c6b1398 |
|
MD5 | 4094f90c2404752a875948beb8a3313a |
|
BLAKE2b-256 | fdd7c26a52d048903128d5f75e06ecc30feab49088cf5f46875da33e3633cc1a |
File details
Details for the file readmetester-2.2.0-py3-none-any.whl
.
File metadata
- Download URL: readmetester-2.2.0-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.8.11+ Linux/5.16.11-200.fc35.x86_64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a67b0299de899f4240a509e550bff42c979f6391f348a73cf0fb487bae98a1f7 |
|
MD5 | 3d809fb979450ee4a937a2b5c9562637 |
|
BLAKE2b-256 | b7e3531e1b46813b7193040a7d1541b526e513db78d2f2081532e26f07982e30 |