summaryrefslogtreecommitdiffstats
path: root/Lib/sqlite3/test/userfunctions.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-09-05 19:05:05 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-09-05 19:05:05 (GMT)
commita3acea3e07dba03a22dc35ca17ad83baa82e3729 (patch)
tree2a2e4f25b0ea350f0d828ce09b86f6dfbd214606 /Lib/sqlite3/test/userfunctions.py
parent342fd18f5369863dfa0c44bc1f57476fdde587aa (diff)
downloadcpython-a3acea3e07dba03a22dc35ca17ad83baa82e3729.zip
cpython-a3acea3e07dba03a22dc35ca17ad83baa82e3729.tar.gz
cpython-a3acea3e07dba03a22dc35ca17ad83baa82e3729.tar.bz2
Issue #22340: Fix Python 3 warnings in Python 2 tests
Diffstat (limited to 'Lib/sqlite3/test/userfunctions.py')
-rw-r--r--Lib/sqlite3/test/userfunctions.py20
1 files changed, 13 insertions, 7 deletions
diff --git a/Lib/sqlite3/test/userfunctions.py b/Lib/sqlite3/test/userfunctions.py
index 634812d..1d19151 100644
--- a/Lib/sqlite3/test/userfunctions.py
+++ b/Lib/sqlite3/test/userfunctions.py
@@ -24,6 +24,7 @@
import unittest
import sqlite3 as sqlite
+from test import test_support
def func_returntext():
return "foo"
@@ -36,7 +37,8 @@ def func_returnfloat():
def func_returnnull():
return None
def func_returnblob():
- return buffer("blob")
+ with test_support.check_py3k_warnings():
+ return buffer("blob")
def func_returnlonglong():
return 1<<31
def func_raiseexception():
@@ -202,8 +204,9 @@ class FunctionTests(unittest.TestCase):
cur = self.con.cursor()
cur.execute("select returnblob()")
val = cur.fetchone()[0]
- self.assertEqual(type(val), buffer)
- self.assertEqual(val, buffer("blob"))
+ with test_support.check_py3k_warnings():
+ self.assertEqual(type(val), buffer)
+ self.assertEqual(val, buffer("blob"))
def CheckFuncReturnLongLong(self):
cur = self.con.cursor()
@@ -246,7 +249,8 @@ class FunctionTests(unittest.TestCase):
def CheckParamBlob(self):
cur = self.con.cursor()
- cur.execute("select isblob(?)", (buffer("blob"),))
+ with test_support.check_py3k_warnings():
+ cur.execute("select isblob(?)", (buffer("blob"),))
val = cur.fetchone()[0]
self.assertEqual(val, 1)
@@ -269,8 +273,9 @@ class AggregateTests(unittest.TestCase):
b blob
)
""")
- cur.execute("insert into test(t, i, f, n, b) values (?, ?, ?, ?, ?)",
- ("foo", 5, 3.14, None, buffer("blob"),))
+ with test_support.check_py3k_warnings():
+ cur.execute("insert into test(t, i, f, n, b) values (?, ?, ?, ?, ?)",
+ ("foo", 5, 3.14, None, buffer("blob"),))
self.con.create_aggregate("nostep", 1, AggrNoStep)
self.con.create_aggregate("nofinalize", 1, AggrNoFinalize)
@@ -362,7 +367,8 @@ class AggregateTests(unittest.TestCase):
def CheckAggrCheckParamBlob(self):
cur = self.con.cursor()
- cur.execute("select checkType('blob', ?)", (buffer("blob"),))
+ with test_support.check_py3k_warnings():
+ cur.execute("select checkType('blob', ?)", (buffer("blob"),))
val = cur.fetchone()[0]
self.assertEqual(val, 1)