Skip to content
Snippets Groups Projects
Select Git revision
  • 729283dbd99b11044c52fa01b3046dbda015ddf8
  • master default protected
  • vertical_relations
  • lu_without_semantic_frames
  • hierarchy
  • additional-unification-filters
  • v0.1.1
  • v0.1.0
  • v0.0.9
  • v0.0.8
  • v0.0.7
  • v0.0.6
  • v0.0.5
  • v0.0.4
  • v0.0.3
  • v0.0.2
  • v0.0.1
17 results

tests.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"