| 596 | self.assertEqual(original[key], loaded[key]) |
| 597 | |
| 598 | def test_write_roundtrip(self): |
| 599 | tempdir = self.create_tempdir() |
| 600 | output_base = os.path.join(tempdir.full_path, 'test_dataset.lit.jsonl') |
| 601 | lit_dataset.write_examples(self.sample_examples, output_base) |
| 602 | lit_dataset.write_spec(self.data_spec, output_base + '.spec') |
| 603 | |
| 604 | # Read back and compare contents |
| 605 | ds = lit_dataset.load_lit_format(output_base) |
| 606 | self.assertEqual(self.data_spec, ds.spec()) |
| 607 | self.assertEqual(self.sample_examples, ds.examples) |
| 608 | |
| 609 | def test_write_roundtrip_indexed(self): |
| 610 | tempdir = self.create_tempdir() |