You can look at the techniques and regular expressions in the testgen.c.unit test module that is part of a generic test framework called TestGen. TestGen uses a parser to automatically stub / copy functions for testing purposes. The parser is capable of identifying the function/method name as well as the parameters and return type. The only caveat with using regular expressions is the function/method's closing } must be in column zero. If you figure out a different way to get around the restriction or other improvements to the parser let me know.
I'm about to release a newer version, but the area that you would be looking at is not changing so I would go ahead and download the latest that is there. TestGen can be found at sourceforge.net/projects/testgen Regards, Dan Gass -- http://mail.python.org/mailman/listinfo/python-list