testing code

Sharan Basappa sharan.basappa at gmail.com
Thu Jul 5 22:56:50 EDT 2018


Hi All,

I am new to Python though not new to programming.

I have implemented my first program in python that uses ML to do some classification task. The whole code is in a single file currently.
It contains executable code as well as functions.

At the end of the program, I have series of calls that is used to test my code.
Now, I would like to re-structure this to separate test code from the program.
As I have not done this in Python, I am a bit lost.

Please let me know if the following understanding of mine is correct.
I need to put the program code in a separate file and organize every executable code in some form of function. If any code exists outside of function then it is not executable by importing.

Import this in my test program (file/module) and then initiate  calls present in the program.

If there is some simple example, it would help a lot.



More information about the Python-list mailing list