Skip to content

Commit

Permalink
add negative test
Browse files Browse the repository at this point in the history
  • Loading branch information
Danil Tolmachev authored and mkrd committed Nov 27, 2022
1 parent a1c544b commit 21b8a9f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/test_glom_writing.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import pytest

import dictdatabase as DDB

data = {
Expand All @@ -15,3 +17,11 @@ def test_glom_writing():
purchase["status"] = "cancelled"
session.write()
assert DDB.at("users", key="users.Ben.status").read() == "cancelled"


def test_glom_writing_sub_key_not_exists():
DDB.at("users").create(data, force_overwrite=True)
with pytest.raises(KeyError):
with DDB.at("users", key="users.SUBKEY").session() as (session, purchase):
purchase["status"] = "cancelled"
session.write()

0 comments on commit 21b8a9f

Please sign in to comment.