Skip to main content

A sample tool for testing functions

Project description


a simple parametrized test tool for function


from testfunc import test

def foo(a=0, b=0):
    return a+b

# test_data is a list of test cases
# a test case is the form of (args, result) or (args, kw, result)
# if args is a tuple it will be unpacked, if this is not desired, pass `unpack=False` to `test`
test_data = [
        (1, 2),     3
        (1, 1),     3
        (1,),       1
        (),         0
        1, {'b':2}, 3

test(foo, test_data)


check for more examples.

Project details

Release history Release notifications | RSS feed

This version


Download files

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

Files for testfunc, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size testfunc-0.1.tar.gz (3.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