unittest_expander 0.3.0 released

Jan Kaliszewski zuo at kaliszewski.net
Sun Aug 17 00:53:33 CEST 2014


I am pleased to announce the release of unittest_expander 0.3.0.

unittest_expander is a MIT-licensed Python library that provides
flexible and easy-to-use tools to parameterize your unit tests,
especially those based on unittest.TestCase.

The library is compatibile with Python 2.6, 2.7, 3.2, 3.3 and 3.4, and
does not depend on any external packages (uses only the Python standard
library).

Simple usage example:

    import unittest
    from unittest_expander import expand, foreach, param

    @expand
    class TestSomething(unittest.TestCase):
        @foreach(
            'Foo',
            ('Foo', 43),
            param('Foo', spam=44),
            param(foo='Bar', spam=45).label('with bar'),
            empty=param(foo='', spam=46),
        )
        def test_it(self, foo, spam=42, label=None):
            assert foo in ('Foo', 'Bar', '')
            assert 42 <= spam <= 46
            if label == 'with bar':
                assert foo == 'Bar' and spam == 45
            if label == 'empty':
                assert foo == '' and spam == 46

This is only a fraction of the possibilities the unittest_expander
library provides.

Homepage: https://github.com/zuo/unittest_expander
PyPI: https://pypi.python.org/pypi/unittest_expander
Documentation: http://unittest-expander.readthedocs.org/en/latest/


Cheers,
Jan Kaliszewski (zuo)


More information about the Python-announce-list mailing list