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

This version
History Node

0.1

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
testfunc-0.1.tar.gz (3.6 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page