feat: init Scalper — pipeline légal scrape+traduction (SCAL-1..SCAL-12)
- legal-source-check (liste de blocage scanlation, robots.txt, rate limiting) - sources: demo (fixture) + mangadex (API officielle) - cleaner, translator (LLM Mistral + glossaire), QA, exporter (md/json/html) - CLI + pipeline resumable (state.json), 22 tests unitaires - sous-agents Mistral Agents SDK: orchestrator + scraper/translator/qa - skills/ (6 SKILL.md), docs légales, CI GitHub Actions Refs: Jira SCAL-1 (Epic CDC), SCAL-2..SCAL-12 (backlog Scrum)
This commit is contained in:
commit
f38a1d630b
38 files changed
+1733
No files matched your search
@@ -0,0 +1,40 @@
|
||||
import unittest
|
||||
from importlib import resources
|
||||
|
||||
from scalper.cleaner import clean_chapter, detect_language
|
||||
|
||||
|
||||
class TestCleaner(unittest.TestCase):
|
||||
def setUp(self):
|
||||
raw = (resources.files("scalper") / "data" / "demo" / "chapter-1.html").read_text(encoding="utf-8")
|
||||
self.chapter = clean_chapter(raw, {"source": "demo", "license": "fixture"})
|
||||
|
||||
def test_boilerplate_removed(self):
|
||||
text = self.chapter.full_text().lower()
|
||||
self.assertNotIn("soutenez-nous", text)
|
||||
self.assertNotIn("scanlation", text)
|
||||
self.assertNotIn("suivant", text)
|
||||
|
||||
def test_blocks_typed(self):
|
||||
types = [b.type for b in self.chapter.blocks]
|
||||
self.assertIn("narration", types)
|
||||
self.assertIn("dialogue", types)
|
||||
self.assertIn("onomatopoeia", types)
|
||||
self.assertIn("image", types)
|
||||
|
||||
def test_image_placeholder(self):
|
||||
ph = self.chapter.placeholders()
|
||||
self.assertEqual(len(ph), 1)
|
||||
self.assertTrue(ph[0].startswith("[IMG:"))
|
||||
|
||||
def test_language_detected(self):
|
||||
self.assertEqual(self.chapter.meta["language"], "en")
|
||||
|
||||
def test_detect_language(self):
|
||||
self.assertEqual(detect_language("Bonjour le monde, ceci est un test"), "fr")
|
||||
self.assertEqual(detect_language("Hello the world this is a test"), "en")
|
||||
self.assertEqual(detect_language("これはテストです"), "ja")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user