forge
Explore
Log in

Don't you dare go Hollow

hezarfen_rag

Clone
★ 0

0 watching0 forksPython2.4 MiB184b84dAhmet Kaan Gümüş2 months ago189 commits

test_visuals.py43 lines, 1.4 KiBHistoryRawDownload
1"""Faz 0.3d integration testi — 12-bio görsel yoğunluk bulguları (gerçek veri)."""
2import os
3import unittest
4
5import corpus
6
7from src.ingest.visuals import analyze_document, FIGURE, TEXT
8
9BOOK = corpus.book_path()
10
11
12@corpus.requires_book
13class VisualDensity12BioTests(unittest.TestCase):
14 @classmethod
15 def setUpClass(cls):
16 cls.prof = analyze_document(BOOK)
17
18 def test_page_count(self):
19 self.assertGreater(self.prof["page_count"], 50) # korpustan bağımsız
20
21 def test_figure_heavy_share_plausible(self):
22 s = self.prof["summary"]
23 # ölçüm: ~50 sayfa figür-ağırlıklı (~%27). Geniş ama anlamlı aralık.
24 self.assertGreaterEqual(s["figure_heavy"], 20)
25 self.assertLessEqual(s["figure_heavy"], 90)
26 self.assertGreater(s["figure_heavy_pct"], 0.10)
27
28 def test_some_text_only_pages_exist(self):
29 # düz metin yeten sayfalar var → ucuz flash ile işlenebilir
30 self.assertGreater(self.prof["summary"]["low_visual"], 0)
31
32 def test_avg_coverage_range(self):
33 self.assertGreater(self.prof["summary"]["avg_image_coverage"], 0.05)
34 self.assertLess(self.prof["summary"]["avg_image_coverage"], 0.8)
35
36 def test_classes_cover_all_pages(self):
37 s = self.prof["summary"]
38 self.assertEqual(s["figure_heavy"] + s["mixed"] + s["low_visual"],
39 self.prof["page_count"])
40
41
42if __name__ == "__main__":
43 unittest.main()