Skip to main content

Very simple testing framework suitable for beginner programmers, with easy functions for accomplishing most common testing tasks like providing input. Requires Python 3.8+.

Project description

optimism

A very small & simple unit-testing framework designed to provide all the basic necessities to beginner programmers as simply as possible.

Designed by Peter Mawhorter.

Dependencies

Works on Python versions 3.7 and up, with 3.9+ recommended.

Installing

To install from PyPI, run the following command on the command-line:

python3 -m pip install optimism

Once it's installed, you can run the tests using:

pytest --doctest-modules optimism.py
pytest test_examples.py

Usage

Use the testFunction, testFunctionMaybe, testFile, testBlock, and/or testThisNotebookCell functions to establish test managers for specific pieces of code. Then use those managers' checkCodeContains methods to check for the presence/absence of certain code constructs (see the ASTRequirement class) or use the case method to establish a test case w/ specific inputs (one manager can support multiple derived cases w/ different inputs). Finally, use methods of a test case like checkResult or checkPrintedLines to check for specific behavior.

See the documentation for more details on how to use it and what each function does.

Changelog

See the documentation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

optimism-3.1.2.tar.gz (108.5 kB view details)

Uploaded Source

Built Distribution

optimism-3.1.2-py3-none-any.whl (114.5 kB view details)

Uploaded Python 3

File details

Details for the file optimism-3.1.2.tar.gz.

File metadata

  • Download URL: optimism-3.1.2.tar.gz
  • Upload date:
  • Size: 108.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for optimism-3.1.2.tar.gz
Algorithm Hash digest
SHA256 061c499edaf334fe3ac74adce2950ef97928b39ad8eec38c76f4696f5eff7635
MD5 b5633d146829298dece702e6cac1efaf
BLAKE2b-256 71ab0d6efab4d1fd3e395bdd37e0a62bfc3525629dda8a3c8e2f79050ce0191c

See more details on using hashes here.

File details

Details for the file optimism-3.1.2-py3-none-any.whl.

File metadata

  • Download URL: optimism-3.1.2-py3-none-any.whl
  • Upload date:
  • Size: 114.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for optimism-3.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bec30eaf6d3403bb190cc910dc49d58589ad8548b95006893d5b99deed7b35ed
MD5 0495282c3861ea1a56a005f51b4879a1
BLAKE2b-256 0f000664a73211173bf62de9b3db504f7ca048831c068a8367eeb91bde0ddd33

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page