def test_write_file(): d1 = {"a": "1", "b": "2"} jsonutil.write_file("/tmp/labm8.write_file.json", d1) d2 = jsonutil.read_file("/tmp/labm8.write_file.json") fs.rm("/tmp/labm8.write_file.json") jsonutil.write_file("/tmp/labm8.write_file2.json", d1) d3 = jsonutil.read_file("/tmp/labm8.write_file2.json") fs.rm("/tmp/labm8.write_file2.json") assert d1 == d2 == d3
def test_write_file(self): d1 = { "a": "1", "b": "2" } jsonutil.write_file("/tmp/labm8.write_file.json", d1) d2 = jsonutil.read_file("/tmp/labm8.write_file.json") fs.rm("/tmp/labm8.write_file.json") jsonutil.write_file("/tmp/labm8.write_file2.json", d1) d3 = jsonutil.read_file("/tmp/labm8.write_file2.json") fs.rm("/tmp/labm8.write_file2.json") self.assertEqual(d1, d2) self.assertEqual(d1, d3)
def _flush_meta(self): jsonutil.write_file(self.cache.keypath("META"), self.to_json())