# 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
    @patch("swe_pipeline.tempfile")
    @patch("swe_pipeline.shutil")
    @patch("swe_pipeline.process_file")
    def test_one_with_parsed(
        self, process_file_mock, shutil_mock, tempfile_mock, *args
    ):
        options = self._default_options(parsed=True)
        tempfile_mock.mkdtemp.return_value = "/tmp/dir"

        run_pipeline(options, ["file.txt"])

        arguments = process_file_mock.call_args_list[0][0]
        self.assertEqual(arguments[1], "file.txt")
        self.assertEqual(arguments[3]['suc_ne_tagger'], None)
        self.assertEqual(
            arguments[3]['suc_tagger'].__class__.__name__,
            "SucTagger"
        )
        self.assertEqual(arguments[3]['ud_tagger'], None)
        self.assertEqual(arguments[3]['lemmatizer'], None)

        self.assertEqual(shutil_mock.copy.call_count, 1)

    @patch("swe_pipeline.cleanup")
    @patch("swe_pipeline.tempfile")
    @patch("swe_pipeline.process_file")
    def test_tagger_and_lemma(self, process_file_mock, tempfile_mock, *args):
        options = self._default_options(tagged=True, lemmatized=True)
        tempfile_mock.mkdtemp.return_value = "/tmp/dir"


# 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

    @patch("swe_pipeline.tempfile")
    @patch("swe_pipeline.shutil")
    @patch("swe_pipeline.process_file")
    def test_one_with_parsed(
        self, process_file_mock, shutil_mock, tempfile_mock, *args
    ):
        options = self._default_options(parsed=True)
        tempfile_mock.mkdtemp.return_value = "/tmp/dir"

        run_pipeline(options, ["file.txt"])

        arguments = process_file_mock.call_args_list[0][0]
        self.assertEqual(arguments[1], "file.txt")
        self.assertEqual(arguments[3]['suc_ne_tagger'], None)
        self.assertEqual(
            arguments[3]['suc_tagger'].__class__.__name__,
            "SucTagger"
        )
        self.assertEqual(arguments[3]['ud_tagger'], None)
        self.assertEqual(arguments[3]['lemmatizer'], None)

        self.assertEqual(shutil_mock.copy.call_count, 1)

    @patch("swe_pipeline.cleanup")
    @patch("swe_pipeline.tempfile")
    @patch("swe_pipeline.process_file")
    def test_tagger_and_lemma(self, process_file_mock, tempfile_mock, *args):
        options = self._default_options(tagged=True, lemmatized=True)
        tempfile_mock.mkdtemp.return_value = "/tmp/dir"


        run_pipeline(options, ["file.txt"])