insert_all() / .upsert_all() work with empty list (#64)

Closes #52
This commit is contained in:
Simon Willison 2019-11-06 20:32:37 -08:00 committed by GitHub
commit 8dab9fd1cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View file

@ -789,3 +789,12 @@ def test_drop_view(fresh_db):
assert ["foo_view"] == fresh_db.view_names()
assert None is fresh_db["foo_view"].drop()
assert [] == fresh_db.view_names()
def test_insert_upsert_all_empty_list(fresh_db):
fresh_db["t"].insert({"foo": 1})
assert 1 == fresh_db["t"].count
fresh_db["t"].insert_all([])
assert 1 == fresh_db["t"].count
fresh_db["t"].upsert_all([])
assert 1 == fresh_db["t"].count