| 1 | from pathlib import Path |
| 2 | import runpy |
| 3 | import shutil |
| 4 | from tempfile import TemporaryDirectory |
| 5 | import unittest |
| 6 | |
| 7 | ROOT = Path(__file__).resolve().parent.parent |
| 8 | FIXTURE = ROOT / 'corpus/table-growth' |
| 9 | compare = runpy.run_path(str(ROOT / 'tools/verify-document.py'))['compare'] |
| 10 | |
| 11 | |
| 12 | class TableGrowthTest(unittest.TestCase): |
| 13 | def test_onenote_reads_object_groups_whose_id_tables_have_gaps(self): |
| 14 | with TemporaryDirectory() as temporary: |
| 15 | native = Path(temporary) / 'read' |
| 16 | shutil.copytree(FIXTURE / 'cold/read', native) |
| 17 | compare(FIXTURE / 'candidate/notebook', native) |
| 18 | self.assertIn('and a few more words', (native / 'page-000.xml').read_text(encoding='utf-8-sig')) |
| 19 | self.assertEqual((FIXTURE / 'candidate/notebook/synthetic.one').read_bytes(), |
| 20 | (FIXTURE / 'cold/notebook/synthetic.one').read_bytes()) |
| 21 | |
| 22 | |
| 23 | if __name__ == '__main__': |
| 24 | unittest.main() |