summaryrefslogtreecommitdiffstats
path: root/Lib/sqlite3/test/regression.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/sqlite3/test/regression.py')
-rw-r--r--Lib/sqlite3/test/regression.py27
1 files changed, 26 insertions, 1 deletions
diff --git a/Lib/sqlite3/test/regression.py b/Lib/sqlite3/test/regression.py
index 648ada5..25e4b63 100644
--- a/Lib/sqlite3/test/regression.py
+++ b/Lib/sqlite3/test/regression.py
@@ -22,7 +22,7 @@
# 3. This notice may not be removed or altered from any source distribution.
import unittest
-import pysqlite2.dbapi2 as sqlite
+import sqlite3 as sqlite
class RegressionTests(unittest.TestCase):
def setUp(self):
@@ -36,6 +36,31 @@ class RegressionTests(unittest.TestCase):
cur = self.con.cursor()
cur.execute("pragma user_version")
+ def CheckPragmaSchemaVersion(self):
+ # This still crashed pysqlite <= 2.2.1
+ con = sqlite.connect(":memory:", detect_types=sqlite.PARSE_COLNAMES)
+ try:
+ cur = self.con.cursor()
+ cur.execute("pragma schema_version")
+ finally:
+ cur.close()
+ con.close()
+
+ def CheckStatementReset(self):
+ # pysqlite 2.1.0 to 2.2.0 have the problem that not all statements are
+ # reset before a rollback, but only those that are still in the
+ # statement cache. The others are not accessible from the connection object.
+ con = sqlite.connect(":memory:", cached_statements=5)
+ cursors = [con.cursor() for x in xrange(5)]
+ cursors[0].execute("create table test(x)")
+ for i in range(10):
+ cursors[0].executemany("insert into test(x) values (?)", [(x,) for x in xrange(10)])
+
+ for i in range(5):
+ cursors[i].execute(" " * i + "select x from test")
+
+ con.rollback()
+
def suite():
regression_suite = unittest.makeSuite(RegressionTests, "Check")
return unittest.TestSuite((regression_suite,))