Skip to content
Snippets Groups Projects
Select Git revision
  • 2d8783a5a5dcd247a01c8a24ec40c7ab6dc90fca
  • master default protected
  • deanonimzer
  • v2 protected
  • v1 protected
  • develop protected
6 results

test_default.py

Blame
  • test_default.py 1.05 KiB
    from src.pipeline.default import DefaultPipeline
    from src.annotations import NameAnnotation
    from src.input_parsers.interface import InputParser
    from src.detectors.interface import Detector
    from src.suppressors.interface import Suppressor
    from src.replacers.interface import ReplacerInterface
    
    class MockInputParser(InputParser):
        def parse(self, input):
            return "ala ma kota", {}
        
    class MockDetector(Detector):
        def detect(self, text, annotations):
            return [(0, 3, NameAnnotation())]
        
    class MockSuppressor(Suppressor):
        def suppress(self, annotations):
            return annotations
        
    class MockReplacer(ReplacerInterface):
        def replace(self, text, annotations):
            return "zbigniew ma kota", annotations
    
    def test_default_pipeline():
        # TODO: Prepare mocks that will better test the pipeline
        pipeline = DefaultPipeline(
            MockInputParser(),
            {"mock_detector": MockDetector()},
            MockSuppressor(),
            {"mock_replacer": MockReplacer()}
        )
        
        assert pipeline.run("/test.txt") == "zbigniew ma kota"