Skip to main content

Testr

Hi, say hello to Testr!

Testr is an automatic unit and integration testing framework for Python.

Testr works by allowing you to give it a function and a expected output, if the expected output does not match the actual output then Testr will mark that Test as failed!

Usage

Creating a Test

To create a test, use the following format:

Testr.Test(<Function>, <Expected Output>)

For the duration of this document, the function used in Tests will be called the Reactant and the expected output will be called the Product.

If you would like to provide arguments to the Reactant when the Test is ran, you can add the keyword parameter ReactantArguments with a tuple containing the arguments, like this:

Testr.Test(<Reactant>, <Product>, ReactantArguments=<Reactant Arguments>)

Creating a TestingGroup

Testr allows for the creation of another type, called a TestingGroup, a TestingGroup allows you to group tests together and even print them to the console in a pretty format!

To create a TestingGroup, use the following format:

Testr.TestingGroup(<TestingGroup Name>, <List Of Test Objects>)

You may also provide the keyword arguments Exit and Print, both are booleans, Exit being True will make Testr exit your program after testing the group, and Print being True will make Testr print the results to the console in a pretty format.

Exit has a default of False and Print has a default of True.

Methods

Both Test and TestingGroup objects support the following methods:

.Test(): Execute this Test or every Test in this TestingGroup.

.GetPassed(): Return a Boolean or NoneType to whether this Test or TestingGroup passed.

.GetTested(): Return a Boolean of whether this Test's or TestingGroup's .Test() method has previously been called.

Test Exclusive

.GetReactant(): Return the reactant that was provided to the Test when it was created.

.GetProduct(): Return the product that was provided to the Test when it was created.

.SetReactant(): Set the Test's Reactant.

.SetProduct(): Set the Test's Product.

TestingGroup Exclusive

.GetPassedTests(): Return a list of all Tests that passed.

.GetFailedTests(): Return a list of all Tests that failed.

.SetGroupName(): Set the TestingGroup's name.

.SetTests(): Set the Tests for the TestingGroup.

Metadata

Release files for testr-frame 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for testr-frame 0.0.1
File Interpreter ABI Platform
testr_frame-0.0.1-py3-none-any.whl Python 3 none any Details

Release files / testr_frame-0.0.1-py3-none-any.whl

Download URL testr_frame-0.0.1-py3-none-any.whl
Size 2.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
45d14d5c1fd87d92efbf0d60301ccdd764f919b68e0797ebcc5a4be3f6d33be1
BLAKE2b-256 checksum
How to use checksums
1d05172b81251ec26bbc6c2401295ed839ec05d15d7ba0e1dc45342e142667a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page