Test saving data to JSONL file.
(self, jsonl_format, temp_dir, sample_data_list)
| 230 | assert data[0] == {"valid": True} |
| 231 | |
| 232 | def test_save_jsonl(self, jsonl_format, temp_dir, sample_data_list): |
| 233 | """Test saving data to JSONL file.""" |
| 234 | filepath = os.path.join(temp_dir, "output.jsonl") |
| 235 | jsonl_format.save(sample_data_list, filepath) |
| 236 | |
| 237 | assert os.path.exists(filepath) |
| 238 | with open(filepath, "r", encoding="utf-8") as f: |
| 239 | lines = f.readlines() |
| 240 | assert len(lines) == len(sample_data_list) |
| 241 | |
| 242 | def test_save_jsonl_each_line_valid_json( |
| 243 | self, jsonl_format, temp_dir, sample_data_list |