File size: 669 Bytes
db06ffa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import tempfile
import unittest
from pathlib import Path

from zsgdp.profiling import profile_document


class ProfilerTests(unittest.TestCase):
    def test_text_profile_detects_table(self):
        with tempfile.TemporaryDirectory() as tmp:
            path = Path(tmp) / "sample.md"
            path.write_text("# Revenue\n\n| Region | Q1 |\n| --- | --- |\n| NA | 10 |\n", encoding="utf-8")

            profile = profile_document(path)

        self.assertEqual(profile.file_type, "markdown")
        self.assertEqual(profile.page_count, 1)
        self.assertGreaterEqual(profile.pages[0].table_candidate_count, 1)


if __name__ == "__main__":
    unittest.main()