Python unittest helpers adapted from Testify
Project description
All the assertions from Testify but cleaned up a bit & with added py3k support.
Should work with Python 2.5-3.3 and pypy 1.9. To make sure it will work for you: python setup.py test.
Installation
There are no dependencies. Simply: pip install testy
Example Usage
import re
import unittest
from testy.assertions import assert_dict_subset, assert_raises, assert_match_regex
class MyTestCase(unittest.TestCase):
def setUp(self):
self.x = dict(a=1, b=2)
def test_x(self):
assert_dict_subset(dict(b=2), self.x)
def test_exception(self):
with assert_raises(TypeError):
raise TypeError("Call some code you expect to fail here.")
def test_pattern(self):
pattern = re.compile('\w')
assert_match_regex(pattern, 'abc')
def tearDown(self):
self.x = None
if __name__ == "__main__":
unittest.main()
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
testy-0.4.tar.gz
(9.9 kB
view details)
File details
Details for the file testy-0.4.tar.gz
.
File metadata
- Download URL: testy-0.4.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a0cb790de19741cf72124e15821724dcf47337fce4afc9a099bd449847d6229 |
|
MD5 | 1f76a75da8f7cd6e25e4f33afa51d9be |
|
BLAKE2b-256 | 8001bae95140c450a481efeedfc24daa98eacb95635003de2b980896ecfb2b4c |