I'm fairly experienced with python as a tool for datascience, no CS background (but eager to learn).
I've inherited a 3K line python script (simulates thermal effects on a part of a machine). It was built organically by physics people used to matlab. I've cleaned it up and modularized it (put it into a class and functions). Now I want an easy way to be certain it's working correctly after someone updates it. There have been some frustrating debugging sessions lately. I figure testing of some form can help there.
My question is how do I even get started in this case of a large existing script? I see pytest and unittest but is that where I should start? The code is roughly structured like this:
class Simulator:
parameters = input_file
def __init__(self):
self.fn1
self.fn2
self.fn3
def fn1():
# with nested functions
def fn2
def fn3
...
def fn(n)
Each function either generates or acts on some data. Would a way to test to have some standardized input/output run and check against that? Is there a way to do this within the standard convention of testing?
Appreciate any advice or tips, cheers!
Aucun commentaire:
Enregistrer un commentaire