quickdemo
For when unit tests would be too much!
quickdemo is a tiny Python library for code demonstrations and small-scale testing.
If your debugging tool of choice is printing to stdout, this might be the right library for you.
quickdemo allows you to decorate any module-level function with an invocation or testing directive:
import quickdemo as qd
@qd.expect([1, 2], [0, 1], 1)
@qd.run([1, 2, 3], 5)
def add_to_list(input_list, number):
return [x + number for x in input_list]
The snippet above produces the following output:
add_to_list([1, 2, 3], 5) -> [6, 7, 8]
Passed: add_to_list([0, 1], 1)
Check out the showcase*.py files for more examples!
I developed quickdemo for two reasons:
Firstly, when presenting solutions to other people, I always wrote several print statements per function to demonstrate the correctness of the solution.
The print statements always added up quickly, making it difficult to discern which output corresponded to which function.
Also, changing any function name implied re-writing the invocation code.
This was especially tedious when working with Jupyter Notebooks, where you have to take great care to re-run a cell each time something changes.
Secondly, there is an educational programming language called Pyret, which allows writing short unit tests as part of a function definition.
I believe this to be a sensible choice when targeting beginners.
Unfortunately, Pyret code is neither readable nor particularly fast, so I decided to introduce this feature to Python as a part of quickdemo.
Metadata
Release files for quickdemo 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| quickdemo-0.2.0.tar.gz | 6.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| quickdemo-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.3 kB
Release files / quickdemo-0.2.0.tar.gz
| Download URL | quickdemo-0.2.0.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
57f64441e87c0582e6f1455e0717ef1ea0fdd6c83af56bd0e37458b9e4ec6207
|
|
BLAKE2b-256 checksum How to use checksums |
4aca0ccff8fad3e0899212b24ecdaac75c5ffec809f1438a244c7db8b3f5f2ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.5
|
Release files / quickdemo-0.2.0-py3-none-any.whl
| Download URL | quickdemo-0.2.0-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b8d704596db426d5dabcb3e7a65f50779a17ec00c8418796663aa0a76d62e617
|
|
BLAKE2b-256 checksum How to use checksums |
848029bf5fb2b25ab04fed9d867fe7a9d5383d6fed54381e9809e3359682af2b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.5
|