diff options
author | Erlend Egeberg Aasland <erlend.aasland@innova.no> | 2021-11-05 17:19:43 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-05 17:19:43 (GMT) |
commit | 3d42cd9461e60c7427f3793f640cd975fbd99289 (patch) | |
tree | dfc35e75ef8c48121bb5cb402a96eda10f62c371 /Lib/test/test_sqlite3/test_userfunctions.py | |
parent | 71e8a3e76a32f5eabe20e7fa984f384ca9af6ec6 (diff) | |
download | cpython-3d42cd9461e60c7427f3793f640cd975fbd99289.zip cpython-3d42cd9461e60c7427f3793f640cd975fbd99289.tar.gz cpython-3d42cd9461e60c7427f3793f640cd975fbd99289.tar.bz2 |
bpo-45243: Use connection limits to simplify `sqlite3` tests (GH-29356)
Diffstat (limited to 'Lib/test/test_sqlite3/test_userfunctions.py')
-rw-r--r-- | Lib/test/test_sqlite3/test_userfunctions.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_sqlite3/test_userfunctions.py b/Lib/test/test_sqlite3/test_userfunctions.py index ad40847..62a11a5 100644 --- a/Lib/test/test_sqlite3/test_userfunctions.py +++ b/Lib/test/test_sqlite3/test_userfunctions.py @@ -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(): |