コード例 #1
0
ファイル: tests.py プロジェクト: hallman76/python-jsonstore
 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))
コード例 #2
0
 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))