MCPcopy Index your code
hub / github.com/tirth8205/code-review-graph / test_write_csv

Function test_write_csv

tests/test_eval.py:158–175  ·  view source on GitHub ↗

Write results to CSV and read back.

()

Source from the content-addressed store, hash-verified

156
157@pytest.mark.skipif(not _HAS_YAML, reason="pyyaml not installed")
158def test_write_csv():
159 """Write results to CSV and read back."""
160 with tempfile.TemporaryDirectory() as tmpdir:
161 path = Path(tmpdir) / "results" / "test.csv"
162 results = [
163 {"repo": "foo", "tokens": 100, "ratio": 2.5},
164 {"repo": "bar", "tokens": 200, "ratio": 1.5},
165 ]
166 write_csv(results, path)
167
168 assert path.exists()
169 with open(path, newline="") as f:
170 reader = csv.DictReader(f)
171 rows = list(reader)
172
173 assert len(rows) == 2
174 assert rows[0]["repo"] == "foo"
175 assert rows[1]["tokens"] == "200"
176
177
178@pytest.mark.skipif(not _HAS_YAML, reason="pyyaml not installed")

Callers

nothing calls this directly

Calls 1

write_csvFunction · 0.90

Tested by

no test coverage detected