1import json
2from pathlib import Path
3import runpy
4import shutil
5from tempfile import TemporaryDirectory
6import unittest
7
8ROOT = Path(__file__).resolve().parent.parent
9FIXTURE = ROOT / 'corpus/cross-run-edit'
10compare = runpy.run_path(str(ROOT / 'tools/verify-document.py'))['compare']
11
12
13class CrossRunEditTest(unittest.TestCase):
14 def test_cold_native_text_styles_and_structure(self):
15 for case in json.loads((FIXTURE / 'manifest.json').read_text())['cases']:
16 with self.subTest(case=case['name']), TemporaryDirectory() as temporary:
17 fixture = FIXTURE / case['name']
18 native = Path(temporary) / 'read'
19 shutil.copytree(fixture / 'cold/read', native)
20 compare(fixture / 'candidate', native)
21 compare(fixture / 'cold/notebook', native)
22
23
24if __name__ == '__main__':
25 unittest.main()