[python-nl] testing

Johnny deBris johnny at johnnydebris.net
Fri Apr 23 13:43:13 CEST 2010


C.T. Matsumoto wrote:
> At least for this example, it seems funny that some of the convenience 
> functions on a type, when strung together can do some pretty weird 
> things that need checking, but nevertheless are nicely placed in the 
> function your are using them in. A better example is re.
>
Yes, though as Konrad suggests, it does make sense to not string 
together too much of that functionality... If you feel uncertain about a 
piece of code and want to test it, do split it up so it becomes easier 
to test, it is usually not bad to change your code to improve 
testability. Also it has several additional advantages, such as making 
the code more readable and making it easier to override bits (especially 
if you're using classes/objects).

Cheers,

Guido


More information about the Python-nl mailing list