# Path: swe_pipeline.py
# def run_pipeline(options, args):
#     models = {
#         "suc_ne_tagger": None,
#         "suc_tagger": None,
#         "ud_tagger": None,
#         "lemmatizer": None,
#     }
#     if options.tagged or options.ner or options.parsed:
#         models["suc_tagger"] = SucTagger(options.tagging_model)
# 
#         if options.lemmatized:
#             models["ud_tagger"] = UDTagger(options.ud_tagging_model)
# 
#     if options.ner:
#         models["suc_ne_tagger"] = SucNETagger(options.ner_model)
# 
#     # Set up the working directory
#     tmp_dir = tempfile.mkdtemp("-stb-pipeline")
#     if options.parsed:
#         shutil.copy(
#             os.path.join(SCRIPT_DIR, options.parsing_model + ".mco"),
#             tmp_dir
#         )
# 
#     if options.lemmatized:
#         models["lemmatizer"] = SUCLemmatizer()
#         models["lemmatizer"].load(options.lemmatization_model)
# 
#     # Process each input file
#     for filename in args:
#         process_file(
#             options,
#             filename,
#             tmp_dir,
#             models,
#             (True if options.non_capitalized else None)
#         )
# 
#     cleanup(options, tmp_dir)


from swe_pipeline import run_pipeline
from unittest.mock import patch, MagicMock
import tempfile
import unittest

class TestRunner(unittest.TestCase):
    def setUp(self):
        self.file = tempfile.NamedTemporaryFile()

    def tearDown(self):
        self.file.close()

    def _default_options(
        self, tagged=False, ner=False, parsed=False, lemmatized=False
    ):
        options = MagicMock()
        options.tagged = tagged
        options.tagging_model = self.file.name
        options.ud_tagging_model = self.file.name
        options.ner = ner
        options.ner_model = self.file.name
        options.parsed = parsed
        options.parsing_model = self.file.name
        options.lemmatized = lemmatized
        options.lemmatization_model = self.file.name

        return options

    @patch("swe_pipeline.cleanup")
    @patch("swe_pipeline.tempfile")
    @patch("swe_pipeline.process_file")
    def test_empty_options(self, process_file_mock, *args):
        options = self._default_options()

# Path: swe_pipeline.py
# def run_pipeline(options, args):
#     models = {
#         "suc_ne_tagger": None,
#         "suc_tagger": None,
#         "ud_tagger": None,
#         "lemmatizer": None,
#     }
#     if options.tagged or options.ner or options.parsed:
#         models["suc_tagger"] = SucTagger(options.tagging_model)
# 
#         if options.lemmatized:
#             models["ud_tagger"] = UDTagger(options.ud_tagging_model)
# 
#     if options.ner:
#         models["suc_ne_tagger"] = SucNETagger(options.ner_model)
# 
#     # Set up the working directory
#     tmp_dir = tempfile.mkdtemp("-stb-pipeline")
#     if options.parsed:
#         shutil.copy(
#             os.path.join(SCRIPT_DIR, options.parsing_model + ".mco"),
#             tmp_dir
#         )
# 
#     if options.lemmatized:
#         models["lemmatizer"] = SUCLemmatizer()
#         models["lemmatizer"].load(options.lemmatization_model)
# 
#     # Process each input file
#     for filename in args:
#         process_file(
#             options,
#             filename,
#             tmp_dir,
#             models,
#             (True if options.non_capitalized else None)
#         )
# 
#     cleanup(options, tmp_dir)


# Path: tests/test_pipeline_runner.py
from swe_pipeline import run_pipeline
from unittest.mock import patch, MagicMock
import tempfile
import unittest


class TestRunner(unittest.TestCase):
    def setUp(self):
        self.file = tempfile.NamedTemporaryFile()

    def tearDown(self):
        self.file.close()

    def _default_options(
        self, tagged=False, ner=False, parsed=False, lemmatized=False
    ):
        options = MagicMock()
        options.tagged = tagged
        options.tagging_model = self.file.name
        options.ud_tagging_model = self.file.name
        options.ner = ner
        options.ner_model = self.file.name
        options.parsed = parsed
        options.parsing_model = self.file.name
        options.lemmatized = lemmatized
        options.lemmatization_model = self.file.name

        return options

    @patch("swe_pipeline.cleanup")
    @patch("swe_pipeline.tempfile")
    @patch("swe_pipeline.process_file")
    def test_empty_options(self, process_file_mock, *args):
        options = self._default_options()

        run_pipeline(options, [])