mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-09 18:14:09 +02:00
Support repeated calls to Table.convert()
* Test repeated calls to Table.convert() * Register Table.convert() functions under their own `lambda_hash` name * Raise exception on registering identical function names Refs #525
This commit is contained in:
parent
6500fed8b2
commit
02f5c4d69d
3 changed files with 35 additions and 9 deletions
|
|
@ -147,3 +147,12 @@ def test_convert_multi_exception(fresh_db):
|
|||
table.insert({"title": "Mixed Case"})
|
||||
with pytest.raises(BadMultiValues):
|
||||
table.convert("title", lambda v: v.upper(), multi=True)
|
||||
|
||||
|
||||
def test_convert_repeated(fresh_db):
|
||||
table = fresh_db["table"]
|
||||
col = "num"
|
||||
table.insert({col: 1})
|
||||
table.convert(col, lambda x: x*2)
|
||||
table.convert(col, lambda _x: 0)
|
||||
assert table.get(1) == {col: 0}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue