Spaces:
Running on Zero
Running on Zero
| 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() | |