1from pathlib import Path
2import runpy
3import shutil
4from tempfile import TemporaryDirectory
5import unittest
6
7ROOT = Path(__file__).resolve().parent.parent
8FIXTURE = ROOT / 'corpus/table-growth'
9compare = runpy.run_path(str(ROOT / 'tools/verify-document.py'))['compare']
10
11
12class 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
23if __name__ == '__main__':
24 unittest.main()