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)
Built Distribution
quicktests-0.0.4-py3-none-any.whl
(15.8 kB
view hashes)
Close
Hashes for quicktests-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ffbf787e87958e13b8ba8275d63db699df54953fac42d71cdf478b7ffaa07417 |
|
MD5 | 632054bf77a094054c3ada09d2e3b7c6 |
|
BLAKE2b-256 | ea919130589c7933b2fd3c6973fcbeb1b231b70e31a546e9991adbe31886da84 |