diff options
author | Berker Peksag <berker.peksag@gmail.com> | 2016-06-12 10:41:47 (GMT) |
---|---|---|
committer | Berker Peksag <berker.peksag@gmail.com> | 2016-06-12 10:41:47 (GMT) |
commit | c415440faa67c488fd2a5d8fc0977cbd660c4a90 (patch) | |
tree | b5e92897b32f8c6543db8bc6e88f7ab2a0a04591 /Lib | |
parent | 00eaa8a53b72d511ba50dbeec739d46b0ce187fd (diff) | |
download | cpython-c415440faa67c488fd2a5d8fc0977cbd660c4a90.zip cpython-c415440faa67c488fd2a5d8fc0977cbd660c4a90.tar.gz cpython-c415440faa67c488fd2a5d8fc0977cbd660c4a90.tar.bz2 |
Issue #27188: Fix various sqlite3 documentation errors
* Connection.execute* methods don't create intermediate cursor objects
* Fix description of seq_of_parameters parameter
* Clarify that Warning is sqlite3.Warning
* sql_script parameter of Cursor.executescript() doesn't accept bytes
* Add missing tests
* Fix various markup errors
Initial patch by Dave Sawyer.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/sqlite3/test/dbapi.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/sqlite3/test/dbapi.py b/Lib/sqlite3/test/dbapi.py index 04649fc..04d0479 100644 --- a/Lib/sqlite3/test/dbapi.py +++ b/Lib/sqlite3/test/dbapi.py @@ -250,6 +250,11 @@ class CursorTests(unittest.TestCase): row = self.cu.fetchone() self.assertEqual(row[0], "Hu\x00go") + def CheckExecuteNonIterable(self): + with self.assertRaises(ValueError) as cm: + self.cu.execute("insert into test(id) values (?)", 42) + self.assertEqual(str(cm.exception), 'parameters are of unsupported type') + def CheckExecuteWrongNoOfArgs1(self): # too many parameters try: @@ -725,6 +730,13 @@ class ExtensionTests(unittest.TestCase): raised = True self.assertEqual(raised, True, "should have raised an exception") + def CheckCursorExecutescriptAsBytes(self): + con = sqlite.connect(":memory:") + cur = con.cursor() + with self.assertRaises(ValueError) as cm: + cur.executescript(b"create table test(foo); insert into test(foo) values (5);") + self.assertEqual(str(cm.exception), 'script argument must be unicode.') + def CheckConnectionExecute(self): con = sqlite.connect(":memory:") result = con.execute("select 5").fetchone()[0] |