

def test_query_table_with_psycopg2_connection(self):
    db = Database(psycopg2.connect(CONNECTION))
    db.open()
    db.execute('CREATE TABLE SomeTable (id VARCHAR(255))')
    db.execute('INSERT INTO SomeTable VALUES (1)')
    db.execute('INSERT INTO SomeTable VALUES (2)')
    db.execute('SELECT * FROM SomeTable')
    rows = db.fetchall()
    self.assertEqual(True, isinstance(rows, types.GeneratorType))
    self.assertEqual([('1',), ('2',)], list(rows))
    db.rollback()

dataset/ETHPy150Open Dwolla/arbalest/integration/test_database.py DatabaseShould.test_query_table_with_psycopg2_connection/original