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.

Source Distribution

testfunc-0.1.tar.gz (3.6 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page