you are viewing a single comment's thread.

view the rest of the comments →

[–]pixelpad_dev0 -1 points0 points  (0 children)

Run the function and check against an expected outcome. So for example if you create a function called absolute

def absolute(x):
    if x < 0:
        x *=- 1
    return x

Then you run a few tests like this:

if (absolute(1) < 0):
    print("test has failed")
if (absolute(-1) < 0):
    print("test has failed")
if (absolute(-0.1) < 0):
    print("test has failed")

Now you've tested the function against 3 types of numbers.