iteration over methods

Chad Netzer cnetzer at mail.arc.nasa.gov
Tue Jan 7 20:56:49 CET 2003


On Tuesday 07 January 2003 05:14, John Roth wrote:
> "Oliver Vecernik" <vecernik at aon.at> wrote in message
> news:3E1AB7B3.4050404 at aon.at...

> >      def runallmethods(self):
> >          for func in dir(self):
> >              if func[0:4] == 'method':
                         ^^^
                         This will never be true.

should be func[0:6] or func[:6]

that said, I agree with John that looking in the unittest
module will be of interest.  In particular, the getTestCaseNames()
method, which works essentially the same way as yours (but uses
filter())

-- 
Bay Area Python Interest Group - http://www.baypiggies.net/

Chad Netzer
cnetzer at mail.arc.nasa.gov





More information about the Python-list mailing list