Hi Folks,

Newbie question here. I'm trying to set up some unit testing for a database 
abstraction class, and the first thing I want to test is the connection 
parameters. So, my question is, how do I dynamically pass the variables from a 
list, for example to the unittest module so I can maintain the list of test 
cases more easily:

-------------------------

import DB
import unittest
                                                                                
                                                                             
class ConnectString(unittest.TestCase):                                         
                                                                                
                                   
        InvalidStrings=(['pg','test','localhost','5432','test','test']
                ,['pg','test','local',5432,'test','test'])
                                                                                
                                                                             
                                                                                
                                                                             
        def testInvalidStrings(self):
                """Check that invalid connect parameters raise 
InvalidConnectString error"""
                    for i in InvalidStrings:
                           self.assertRaises(DB.InvalidConnectString, 
DB.DB,",".join(i))

------------------------

My problem is, this passes one string containing 
"'pg','test','localhost','5432','test','test'" rather than each one of those as 
variables.

Any help appreciated.

Thanks, Tom
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to