Select Git revision
test_default.py

Michał Pogoda authored
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"