MCPcopy Create free account
hub / github.com/Open-Bee/DataStudio / test_save_json

Method test_save_json

tests/datasets/test_formatters.py:128–136  ·  view source on GitHub ↗

Test saving data to JSON file.

(self, json_format, temp_dir, sample_data_list)

Source from the content-addressed store, hash-verified

126 json_format.load(filepath)
127
128 def test_save_json(self, json_format, temp_dir, sample_data_list):
129 """Test saving data to JSON file."""
130 filepath = os.path.join(temp_dir, "output.json")
131 json_format.save(sample_data_list, filepath)
132
133 assert os.path.exists(filepath)
134 with open(filepath, "r", encoding="utf-8") as f:
135 loaded = json.load(f)
136 assert len(loaded) == len(sample_data_list)
137
138 def test_save_json_with_indent(self, json_format, temp_dir, sample_data_list):
139 """Test saving JSON with custom indent."""

Callers

nothing calls this directly

Calls 3

existsMethod · 0.80
saveMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected