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.

Files for quicktests, version 0.0.4
Filename, size File type Python version Upload date Hashes
Filename, size quicktests-0.0.4-py3-none-any.whl (15.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size quicktests-0.0.4.tar.gz (2.6 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page