MCPcopy Create free account
hub / github.com/cdgriffith/Box / test_toon_files

Method test_toon_files

test/test_coverage_paths.py:322–334  ·  view source on GitHub ↗
(self, tmp_path)

Source from the content-addressed store, hash-verified

320
321class TestFromFilePaths:
322 def test_toon_files(self, tmp_path):
323 if not from_file.toon_available:
324 pytest.skip("toon_format is not installed")
325 good = tmp_path / "data.toon"
326 Box(a=1, b="x").to_toon(filename=good)
327 assert box_from_file(good).to_dict() == {"a": 1, "b": "x"}
328 rows = tmp_path / "rows.toon"
329 BoxList([{"a": 1}, {"a": 2}]).to_toon(filename=rows)
330 assert box_from_file(rows).to_list() == [{"a": 1}, {"a": 2}]
331 bad = tmp_path / "bad.toon"
332 bad.write_text('a: "unterminated\n')
333 with pytest.raises(BoxError, match="not TOON"):
334 box_from_file(bad)
335
336 def test_toon_unavailable(self, tmp_path, monkeypatch):
337 monkeypatch.setattr(from_file, "toon_available", False)

Callers

nothing calls this directly

Calls 6

BoxClass · 0.90
box_from_fileFunction · 0.90
BoxListClass · 0.90
to_dictMethod · 0.80
to_listMethod · 0.80
to_toonMethod · 0.45

Tested by

no test coverage detected