Accessing nested functions for testing

Erik Max Francis max at alcyone.com
Tue May 20 19:38:11 EDT 2003


Chad Netzer wrote:

> If it were straightforward to execute sub-functions, I could provide a
> harness for each that ran them from a conforming namespace.  However,
> it
> seems to be the case that any nested function that is complex enough
> to
> NEED to be tested, is probably important enough to make non-nested in
> anticipation of reusing it. So, practically, it has become a non-issue
> issue.

Indeed.  I'd go the other way around and say that if you're thinking
about testing an inner function, then it sounds like that function is
more than just a trivial implementation detail of the parent function
and so probably deserves to be a separate function in its own right.

-- 
   Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
 __ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/  \ There is _never_ no hope left.  Remember.
\__/  Louis Wu




More information about the Python-list mailing list