def test_cut_set_serialization(cut_set, format, compressed): with NamedTemporaryFile(suffix='.gz' if compressed else '') as f: if format == 'yaml': cut_set.to_yaml(f.name) restored = CutSet.from_yaml(f.name) if format == 'json': cut_set.to_json(f.name) restored = CutSet.from_json(f.name) if format == 'jsonl': cut_set.to_jsonl(f.name) restored = CutSet.from_jsonl(f.name) assert cut_set == restored
def test_cut_set_serialization(cut_set, format, compressed): with NamedTemporaryFile(suffix=".gz" if compressed else "") as f: if format == "yaml": cut_set.to_yaml(f.name) restored = CutSet.from_yaml(f.name) if format == "json": cut_set.to_json(f.name) restored = CutSet.from_json(f.name) if format == "jsonl": cut_set.to_jsonl(f.name) restored = CutSet.from_jsonl(f.name) assert cut_set == restored