mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-25 18:34:32 +02:00
parent
02f5c4d69d
commit
fca3ef8cf2
3 changed files with 12 additions and 5 deletions
|
|
@ -5,6 +5,7 @@ from unittest.mock import MagicMock, call
|
|||
from sqlite_utils.utils import sqlite3
|
||||
from sqlite_utils.db import FunctionAlreadyRegistered
|
||||
|
||||
|
||||
def test_register_function(fresh_db):
|
||||
@fresh_db.register_function
|
||||
def reverse_string(s):
|
||||
|
|
@ -86,6 +87,7 @@ def test_register_function_replace(fresh_db):
|
|||
|
||||
# This will fail to replace the function:
|
||||
with pytest.raises(FunctionAlreadyRegistered):
|
||||
|
||||
@fresh_db.register_function()
|
||||
def one(): # noqa
|
||||
return "two"
|
||||
|
|
@ -103,6 +105,7 @@ def test_register_function_replace(fresh_db):
|
|||
def test_register_function_duplicate(fresh_db):
|
||||
def to_lower(s):
|
||||
return s.lower()
|
||||
|
||||
fresh_db.register_function(to_lower)
|
||||
with pytest.raises(FunctionAlreadyRegistered):
|
||||
fresh_db.register_function(to_lower)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue