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

Uploaded Source

File details

Details for the file testfunc-0.1.tar.gz.

File metadata

  • Download URL: testfunc-0.1.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for testfunc-0.1.tar.gz
Algorithm Hash digest
SHA256 afaae896a5daed24cd8192b9cdcfb1c6881207574049c7b657f3d375f8565ca9
MD5 4a04da0e52c760d2d32e63bb2d7c675b
BLAKE2b-256 d758fd081a36f24bc463597daa3dcfe121a1983d9dcad5b75d30addc67b81d7e

See more details on using hashes here.

Supported by

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