from pysqlite2 import dbapi2 as sqlite def test_open_cursor(): con = sqlite.connect(":memory:") con.execute(""" CREATE TABLE IF NOT EXISTS Triple ( tid INTEGER ) """) con.execute("INSERT INTO Triple (tid) VALUES(789)") con.commit() cur1 = con.execute("SELECT COUNT(*) FROM Triple") res = cur1.next() assert res == (1,) con.execute("INSERT INTO Triple (tid) VALUES(43)") con.commit() cur1 = con.execute("SELECT COUNT(*) FROM Triple") res = cur1.next() assert res == (2,)