mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-24 09:54:31 +02:00
register_function(name=...) argument, closes #458
This commit is contained in:
parent
bfbe69646e
commit
1491b66dd7
3 changed files with 30 additions and 6 deletions
|
|
@ -14,6 +14,15 @@ def test_register_function(fresh_db):
|
|||
assert result == "olleh"
|
||||
|
||||
|
||||
def test_register_function_custom_name(fresh_db):
|
||||
@fresh_db.register_function(name="revstr")
|
||||
def reverse_string(s):
|
||||
return "".join(reversed(list(s)))
|
||||
|
||||
result = fresh_db.execute('select revstr("hello")').fetchone()[0]
|
||||
assert result == "olleh"
|
||||
|
||||
|
||||
def test_register_function_multiple_arguments(fresh_db):
|
||||
@fresh_db.register_function
|
||||
def a_times_b_plus_c(a, b, c):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue