From 067d6d46575b5cf30bbf7c812defee1517106a34 Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Fri, 4 Jun 2021 11:54:39 -0700 Subject: bpo-43853: Handle sqlite3_value_text() errors (GH-25422) (cherry picked from commit 006fd869e4798b68e266f5de89c83ddb531a756b) Co-authored-by: Erlend Egeberg Aasland --- Lib/sqlite3/test/userfunctions.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'Lib/sqlite3') diff --git a/Lib/sqlite3/test/userfunctions.py b/Lib/sqlite3/test/userfunctions.py index 148d9f596a..6f57d1911b 100644 --- a/Lib/sqlite3/test/userfunctions.py +++ b/Lib/sqlite3/test/userfunctions.py @@ -236,9 +236,11 @@ class FunctionTests(unittest.TestCase): def test_param_string(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 test_param_int(self): cur = self.con.cursor() @@ -391,9 +393,9 @@ class AggregateTests(unittest.TestCase): def test_aggr_check_param_str(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 test_aggr_check_param_int(self): cur = self.con.cursor() -- cgit v1.2.1