pyUnit and dynamic test functions
Sakcee
sakcee at gmail.com
Tue Dec 20 19:52:17 EST 2005
Hi
I am trying to use pyUnit to create a framework for testing functions
I am reading function name, expected output, from a text file.
and in python generating dynamic test functions
something like this
class getUsStatesTest( unittest.TestCase ):
self.setUp = lambda : function_call
self.testReturnVal = lambda : self.assertEqual( fileInput,
function_returnedVals )
self.testLength = lambda : self.assertEqual( len(returnedVals)
, len(inp) )
is it possible to load these dynamic functions via pyUnit, instead of
defining in text form ,
can i use loadfromname etc to load these dynamic test functions.
something like this
unittest.TestSuite(unittest.defaultTestLoader.loadTestsFromName(
getUsStatesTest() ))
in this way I can completely automate every function that returns some
output by dynamically generating its
test functions
thanks
More information about the Python-list
mailing list