summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_sqlite3/test_userfunctions.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_sqlite3/test_userfunctions.py')
-rw-r--r--Lib/test/test_sqlite3/test_userfunctions.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/Lib/test/test_sqlite3/test_userfunctions.py b/Lib/test/test_sqlite3/test_userfunctions.py
index 5d12636..d86b8c6 100644
--- a/Lib/test/test_sqlite3/test_userfunctions.py
+++ b/Lib/test/test_sqlite3/test_userfunctions.py
@@ -421,6 +421,29 @@ class FunctionTests(unittest.TestCase):
self.assertRaisesRegex(sqlite.OperationalError, msg,
self.con.execute, "select badreturn()")
+ def test_func_keyword_args(self):
+ regex = (
+ r"Passing keyword arguments 'name', 'narg' and 'func' to "
+ r"_sqlite3.Connection.create_function\(\) is deprecated. "
+ r"Parameters 'name', 'narg' and 'func' will become "
+ r"positional-only in Python 3.15."
+ )
+
+ def noop():
+ return None
+
+ with self.assertWarnsRegex(DeprecationWarning, regex) as cm:
+ self.con.create_function("noop", 0, func=noop)
+ self.assertEqual(cm.filename, __file__)
+
+ with self.assertWarnsRegex(DeprecationWarning, regex) as cm:
+ self.con.create_function("noop", narg=0, func=noop)
+ self.assertEqual(cm.filename, __file__)
+
+ with self.assertWarnsRegex(DeprecationWarning, regex) as cm:
+ self.con.create_function(name="noop", narg=0, func=noop)
+ self.assertEqual(cm.filename, __file__)
+
class WindowSumInt:
def __init__(self):