Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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/
.idea/
16 changes: 14 additions & 2 deletions tests/test_x2text.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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)

Expand Down