diff --git a/.gitignore b/.gitignore index 6769e21d..2dc53ca3 100644 --- a/.gitignore +++ b/.gitignore @@ -157,4 +157,4 @@ cython_debug/ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. -#.idea/ \ No newline at end of file +.idea/ diff --git a/tests/test_x2text.py b/tests/test_x2text.py index 38c48aac..39c65356 100644 --- a/tests/test_x2text.py +++ b/tests/test_x2text.py @@ -6,6 +6,7 @@ from dotenv import load_dotenv from parameterized import parameterized +from unstract.adapters.x2text.constants import LLMWhispererSupportedModes from unstract.sdk.tool.base import BaseTool from unstract.sdk.x2txt import X2Text @@ -33,7 +34,7 @@ def run( settings: dict[str, Any] = {}, workflow_id: str = "", ) -> None: - # self.stream_log("Mock tool running") + # Dummify method for dummy tool pass @classmethod @@ -49,9 +50,20 @@ def test_get_x2text(self, adapter_instance_id): input_file = get_env_value("INPUT_FILE_PATH") output_file = get_env_value("OUTPUT_FILE_PATH") + + if os.path.isfile(output_file): + os.remove(output_file) + file_content = x2text.process( + input_file, output_file, mode=LLMWhispererSupportedModes.OCR.value + ) + file_size = os.path.getsize(output_file) + self.assertGreater(file_size, 0) + if os.path.isfile(output_file): os.remove(output_file) - x2text.process(input_file, output_file) + with open(output_file, "w", encoding="utf-8") as f: + f.write(file_content) + f.close() file_size = os.path.getsize(output_file) self.assertGreater(file_size, 0)