Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

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()
Release History

Release History

This version
History Node

0.4

History Node

0.3.3

History Node

0.3.2

History Node

0.3.1

History Node

0.3

History Node

0.1.1

History Node

0.1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
testy-0.4.tar.gz (9.9 kB) Copy SHA256 Checksum SHA256 Source Dec 26, 2012

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting