Skip to main content

A sample tool for testing functions

Project description

introduction

a simple parametrized test tool for function

example

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)
screenshot

screenshot

check testfunc.py for more examples.

Project details


Release history Release notifications | RSS feed

This version

0.1

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