8000 bpo-43853: Expand test suite for SQLite UDF's by erlend-aasland · Pull Request #27642 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-43853: Expand test suite for SQLite UDF's #27642

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Jan 26, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make test_func_params more specific
  • Loading branch information
Erlend E. Aasland committed Sep 15, 2021
commit 02725cf970d6eb51b91bf8bf96aaa4114a91c486
19 changes: 11 additions & 8 deletion BA85 s Lib/sqlite3/test/test_userfunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,12 @@ def test_param_surrogates(self):
("\ud803\ude6d",))

def test_func_params(self):
dataset = (
results = []
def append_result(arg):
results.append((arg, type(arg)))
self.con.create_function("test_params", 1, append_result)

dataset = [
(42, int),
(-1, int),
(1234567890123456789, int),
Expand All @@ -349,13 +354,11 @@ def test_func_params(self):
(bytearray(range(2)), bytes),
(memoryview(b"blob"), bytes),
(None, type(None)),
)
for val, tp in dataset:
with self.subTest(val=val, tp=tp):
cur = self.con.execute("select boomerang(?)", (val,))
retval = cur.fetchone()[0]
self.assertEqual(type(retval), tp)
self.assertEqual(retval, val)
]
for val, _ in dataset:
cur = self.con.execute("select test_params(?)", (val,))
cur.fetchone()
self.assertEqual(dataset, results)

# Regarding deterministic functions:
#
Expand Down
0