コード例 #1
0
def test_json_dump():
    with open(path_dumps, 'w+') as f:
        JsonWrapper.dump(json_json, f)
    with open(path_dumps, 'r') as f:
        result = JsonWrapper.load(f)
        assert json_json == result
    if os.path.exists(path_dumps):
        os.remove(path_dumps)
コード例 #2
0
 def save(self, key: str, value):
     values = self.load_file()
     values[key] = value
     with open(self.filename, 'w') as f:
         JsonWrapper.dump(values, f)