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

Class TestOtherBackends

test/test_comments.py:312–333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

310
311
312class TestOtherBackends:
313 def test_safe_dumper_ignores_comments(self):
314 bx = Box.from_yaml(DOCUMENT)
315 assert "#" not in bx.to_yaml(ruamel_typ="safe")
316
317 def test_safe_loader_reads_none(self):
318 bx = Box.from_yaml(DOCUMENT, ruamel_typ="safe")
319 assert bx.get_comment(None) is None and bx.get_comment("name") is None
320
321 def test_pyyaml(self, monkeypatch):
322 if not converters.pyyaml_available:
323 pytest.skip("PyYAML is not installed")
324 monkeypatch.setattr(converters, "ruamel_available", False)
325 bx = Box.from_yaml(DOCUMENT)
326 assert bx.get_comment("name") is None
327 bx.set_comment("name", "ignored by PyYAML")
328 assert "#" not in bx.to_yaml()
329
330 def test_output_without_comments_is_unchanged(self):
331 data = {"z": 1, "a": {"b": [1, {"c": 2}]}}
332 assert Box(data).to_yaml() == converters._to_yaml(data)
333 assert BoxList([data]).to_yaml() == converters._to_yaml([data])
334
335
336class TestEdgeCases:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected