import unittest
import sqlite3
conn = sqlite3.connect(":memory:")
cursor = conn.cursor()
cursor.execute("""create table foo (x int, y int)""")
cursor.execute(
"""insert into foo (x, y) values (1, 1), (2, 2), (3, 3), (4, 4)"""
)
class TestSQLiteDescription(unittest.TestCase):
def test_insert(self):
cursor.execute(
"""insert into foo (x, y) values (5, 5), (6, 6)
RETURNING x, y"""
)
assert cursor.description == (
("x", None, None, None, None, None, None),
("y", None, None, None, None, None, None),
)
def test_update(self):
cursor.execute(
"""update foo set y=y+5 where x in (2, 3)
RETURNING x, y"""
)
assert cursor.description == (
("x", None, None, None, None, None, None),
("y", None, None, None, None, None, None),
)
def test_delete(self):
cursor.execute(
"""delete from foo where x in (1, 4)
RETURNING x, y"""
)
assert cursor.description == (
("x", None, None, None, None, None, None),
("y", None, None, None, None, None, None),
)
if __name__ == '__main__':
unittest.main()