dimanche 19 juillet 2020

how to write a test function for a function in python, WITHOUT class

I want to test a function to see if it'w working properly.

I found many answers such as how to write a unit testing function for my function? & unittest

But they all write the test functions under a certain class, while mine function isn't a member a any class.

for example I have this under readTool.py:

def extract_frame_dr(dr, frameID):
    return dr[0, frameID], dr[1, frameID]

How do I write a test_extract_frame_dr for it? I want to have the feature of Auto-discovery of test modules and functions: Run all the tests in readTool.py at once without calling them one by one in the main function.

Thanks

Aucun commentaire:

Enregistrer un commentaire