mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
bpo-45243: Use connection limits to simplify sqlite3
tests (GH-29356)
This commit is contained in:
parent
71e8a3e76a
commit
3d42cd9461
3 changed files with 54 additions and 21 deletions
|
@ -31,6 +31,7 @@ import unittest.mock
|
|||
import sqlite3 as sqlite
|
||||
|
||||
from test.support import bigmemtest
|
||||
from .test_dbapi import cx_limit
|
||||
|
||||
|
||||
def with_tracebacks(strings, traceback=True):
|
||||
|
@ -223,6 +224,14 @@ class FunctionTests(unittest.TestCase):
|
|||
with self.assertRaises(sqlite.OperationalError):
|
||||
self.con.create_function("bla", -100, lambda x: 2*x)
|
||||
|
||||
def test_func_too_many_args(self):
|
||||
category = sqlite.SQLITE_LIMIT_FUNCTION_ARG
|
||||
msg = "too many arguments on function"
|
||||
with cx_limit(self.con, category=category, limit=1):
|
||||
self.con.execute("select abs(-1)");
|
||||
with self.assertRaisesRegex(sqlite.OperationalError, msg):
|
||||
self.con.execute("select max(1, 2)");
|
||||
|
||||
def test_func_ref_count(self):
|
||||
def getfunc():
|
||||
def f():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue