| 374 | box_from_string("a: [1", string_type="yaml") |
| 375 | |
| 376 | def test_box_from_string_toon(self): |
| 377 | if not from_file.toon_available: |
| 378 | pytest.skip("toon_format is not installed") |
| 379 | assert box_from_string(Box(a=1).to_toon(), string_type="toon").to_dict() == {"a": 1} |
| 380 | rows = BoxList([{"a": 1}, {"a": 2}]).to_toon() |
| 381 | assert box_from_string(rows, string_type="toon").to_list() == [{"a": 1}, {"a": 2}] |
| 382 | with pytest.raises(BoxError, match="not TOON"): |
| 383 | box_from_string('a: "unterminated', string_type="toon") |
| 384 | |
| 385 | def test_box_from_string_unknown_type(self): |
| 386 | with pytest.raises(BoxError, match="Unsupported"): |