Is this a good way to implement testing

Mark Lawrence breamoreboy at yahoo.co.uk
Sun May 3 04:38:22 EDT 2015


On 03/05/2015 08:36, Cecil Westerhof wrote:
>
> Thanks for the tips. For most I have to read a ‘little’ first, so I
> will not implement them immediately.
> Another question. Is it acceptable to have it in the module itself, or
> should I put it in something like test_<module>.py? The code for
> testing is bigger as the code for the implementation, so I am leaning
> to putting it in a separate file.
>

I'd go for the former if your implementation code base is measured in 
hundreds of lines of code, anything larger and I'd probably split the 
test code out.  That's just my own rule of thumb, I'm sure others will 
quote different figures, but what it ultimately gets down to is what are 
you comfortable with?  I ask because you should keep in mind that Python 
modules containing several classes and running into thousands of lines 
of code are fairly common.  Python is not Java, and Java isn't Python 
either :)

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence




More information about the Python-list mailing list