Skip to content

A python package that tests function call instances using a simple decorator.

Notifications You must be signed in to change notification settings

ianjure/fancytest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

What is Fancytest?

Fancytest provides a decorator to test function call instances in your program. It will provide the simple status of both failed and successful instances.

How to use Fancytest?

pip install fancytest
from fancytest import ftest # <-- IMPORT THE PACKAGE

@ftest # <-- ADD THE DECORATOR TO THE FUNCTION YOU WANT TO TEST (@ftest)
def add(a, b):
    return a + b

@ftest # <-- ADD THE DECORATOR TO THE FUNCTION YOU WANT TO TEST (@ftest)
def squared(a):
    return a * a

# FAIL
f = add(2, "b")
squared(f)

# SUCCESS
s = add(1,2)
squared(s)

Fancytest will output all instances with their parameters and status.

INSTANCE: add(2, 'b') : FAILED
ERROR: unsupported operand type(s) for +: 'int' and 'str'

INSTANCE: squared(None) : FAILED
ERROR: unsupported operand type(s) for *: 'NoneType' and 'NoneType'

INSTANCE: add(1, 2) : SUCCESS
TIME: 0.000ms

INSTANCE: squared(3) : SUCCESS
TIME: 0.000ms

About

A python package that tests function call instances using a simple decorator.

Topics

Resources

Stars

Watchers

Forks

Languages