mirror of https://github.com/python/cpython.git
[3.11] gh-105557: Remove duplicate sqlite3 test method (GH-105558) (#105562)
test_func_return_too_large_int() was defined twice.
Keep only the redefined method, as that also checks the tracebacks.
(cherry picked from commit b8fa7bda4f
)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
This commit is contained in:
parent
faf15fda28
commit
6dcbd50eb8
|
@ -195,7 +195,6 @@ def setUp(self):
|
||||||
self.con.create_function("returnblob", 0, func_returnblob)
|
self.con.create_function("returnblob", 0, func_returnblob)
|
||||||
self.con.create_function("returnlonglong", 0, func_returnlonglong)
|
self.con.create_function("returnlonglong", 0, func_returnlonglong)
|
||||||
self.con.create_function("returnnan", 0, lambda: float("nan"))
|
self.con.create_function("returnnan", 0, lambda: float("nan"))
|
||||||
self.con.create_function("returntoolargeint", 0, lambda: 1 << 65)
|
|
||||||
self.con.create_function("return_noncont_blob", 0,
|
self.con.create_function("return_noncont_blob", 0,
|
||||||
lambda: memoryview(b"blob")[::2])
|
lambda: memoryview(b"blob")[::2])
|
||||||
self.con.create_function("raiseexception", 0, func_raiseexception)
|
self.con.create_function("raiseexception", 0, func_raiseexception)
|
||||||
|
@ -294,11 +293,6 @@ def test_func_return_nan(self):
|
||||||
cur.execute("select returnnan()")
|
cur.execute("select returnnan()")
|
||||||
self.assertIsNone(cur.fetchone()[0])
|
self.assertIsNone(cur.fetchone()[0])
|
||||||
|
|
||||||
def test_func_return_too_large_int(self):
|
|
||||||
cur = self.con.cursor()
|
|
||||||
self.assertRaisesRegex(sqlite.DataError, "string or blob too big",
|
|
||||||
self.con.execute, "select returntoolargeint()")
|
|
||||||
|
|
||||||
@with_tracebacks(ZeroDivisionError, name="func_raiseexception")
|
@with_tracebacks(ZeroDivisionError, name="func_raiseexception")
|
||||||
def test_func_exception(self):
|
def test_func_exception(self):
|
||||||
cur = self.con.cursor()
|
cur = self.con.cursor()
|
||||||
|
@ -444,9 +438,10 @@ def md5sum(t):
|
||||||
@with_tracebacks(OverflowError)
|
@with_tracebacks(OverflowError)
|
||||||
def test_func_return_too_large_int(self):
|
def test_func_return_too_large_int(self):
|
||||||
cur = self.con.cursor()
|
cur = self.con.cursor()
|
||||||
|
msg = "string or blob too big"
|
||||||
for value in 2**63, -2**63-1, 2**64:
|
for value in 2**63, -2**63-1, 2**64:
|
||||||
self.con.create_function("largeint", 0, lambda value=value: value)
|
self.con.create_function("largeint", 0, lambda value=value: value)
|
||||||
with self.assertRaises(sqlite.DataError):
|
with self.assertRaisesRegex(sqlite.DataError, msg):
|
||||||
cur.execute("select largeint()")
|
cur.execute("select largeint()")
|
||||||
|
|
||||||
@with_tracebacks(UnicodeEncodeError, "surrogates not allowed", "chr")
|
@with_tracebacks(UnicodeEncodeError, "surrogates not allowed", "chr")
|
||||||
|
|
Loading…
Reference in New Issue