def test_no_auto_commit(self): store_file = mktemp() store = JsonStore(store_file, indent=None, auto_commit=False) store.value1 = 1 store['value2'] = 2 with open(store_file) as handle: self.assertEqual({}, json.load(handle))
def test_auto_commit(self): store_file = mktemp() store = JsonStore(store_file, indent=None, auto_commit=True) store.value1 = 1 with open(store_file) as handle: self.assertEqual({"value1": 1}, json.load(handle)) store["value2"] = 2 with open(store_file) as handle: self.assertEqual({"value1": 1, "value2": 2}, json.load(handle))