pyunit implementation
<p>Im trying to pyunit for my python code with a class definition but need some help in understanding</p>

<p>I have defined a class that will take a date input and execute a query and pass a list back,</p>

<p>I need to test the retrieve method.</p>

<p>How will I pass this retrieve method to the the test_positive_method?</p>

<p>code.py</p>

<pre><code>import MySQLdb

from sqlfile import *
import unittest

class test():
    def __init__(self,date):
        self.date = date

    def retrieve(self):

        sqlval = "Select name,sku from products where \
            date    \
            (created_at) = '%s' "
        sqlval1 = sqlval %(self.date)
        print'sqlval=',sqlval1

        db = MySQLdb.connect("127.0.0.1","root","test","ecomstore")
        c = db.cursor()
        c.execute(sqlval1)
        result = c.fetchall()
        list1 = []
        for row in result:
            list1.append(row[0])
        print(list1)

        return list1

class AddTest(unittest.TestCase):
    def test_positive_add(self):
        self.assertEqual(


if __name__ == '__main__':
    x = test('2012-07-11')
    lista=x.conn_to_sql()
    print('lista',lista)
</code></pre>
