Skip to main content

A library for python for easy testing.

Project description

quicktests

A library for python for easy testing.

Example

Example 1: TestBase

from quicktests import print_report, TestBase


class Test(TestBase):
    def test_one_equals_one(self):
        assert 1 == 1, "One does not equal one"

    def test_one_equals_one_str(self):
        assert "One" == "One", "\"One\" does not equal \"One\""


if __name__ == '__main__':
    print_report(Test())

The code above provides the following information:

Ran 2 tests.
Running tests took 4.887580871582031e-05 seconds.
No failed tests.
No errors were found. Add more code to verify your code is working.

Example 2: MiniTest

from quicktests import print_report, MiniTest


if __name__ == '__main__':
    def complex_test():
        return False

    print_report(
        MiniTest(
            test_true=[
                lambda: True,
                "Returns True"
            ],
            test_false=[
                lambda: False,
                "Returns False"
            ],
            test_error=[
                lambda: 1 / 0,
                "This is wrong"
            ],
            test_complex=[
                complex_test,
                "This is complex"
            ],
            test_with_really_long_name=[
                lambda: False,
                "This is a long name",
            ]
        )
    )

The code above provides the following information:

Ran 5 tests.
Running tests took 4.076957702636719e-05 seconds.
4 failed tests:
1. test 'complex':               <class 'AssertionError'> -> This is complex
2. test 'error':                 <class 'ZeroDivisionError'> -> division by zero
3. test 'false':                 <class 'AssertionError'> -> Returns False
5. test 'with really long name': <class 'AssertionError'> -> This is a long name

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

quicktests-0.0.4.tar.gz (2.6 kB view hashes)

Uploaded Source

Built Distribution

quicktests-0.0.4-py3-none-any.whl (15.8 kB view hashes)

Uploaded Python 3

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