[3.9] bpo-43853: Handle sqlite3_value_text() errors (GH-25422). (GH-27627)

(cherry picked from commit 006fd869e4)
This commit is contained in:
Erlend Egeberg Aasland 2021-08-06 19:57:39 +02:00 committed by GitHub
parent 8c17db6cd4
commit 8c07fef867
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 16 deletions

View file

@ -236,9 +236,11 @@ class FunctionTests(unittest.TestCase):
def CheckParamString(self):
cur = self.con.cursor()
cur.execute("select isstring(?)", ("foo",))
val = cur.fetchone()[0]
self.assertEqual(val, 1)
for text in ["foo", str()]:
with self.subTest(text=text):
cur.execute("select isstring(?)", (text,))
val = cur.fetchone()[0]
self.assertEqual(val, 1)
def CheckParamInt(self):
cur = self.con.cursor()
@ -387,9 +389,9 @@ class AggregateTests(unittest.TestCase):
def CheckAggrCheckParamStr(self):
cur = self.con.cursor()
cur.execute("select checkType('str', ?)", ("foo",))
cur.execute("select checkTypes('str', ?, ?)", ("foo", str()))
val = cur.fetchone()[0]
self.assertEqual(val, 1)
self.assertEqual(val, 2)
def CheckAggrCheckParamInt(self):
cur = self.con.cursor()