Skip to content

Commit

Permalink
bugfix: fixing test_markitdown.py; updating exception messages
Browse files Browse the repository at this point in the history
  • Loading branch information
tungsten106 committed Dec 27, 2024
1 parent 8482477 commit f07ea3e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/markitdown/_markitdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -702,8 +702,8 @@ def convert(
return None
if engine is not None and engine not in self._engines:
raise FileConversionException(
"'pdf_engine' not valid. Please choose between {}.".format(
list(self._engines.keys())
"'engine' not valid for {} files. Please choose between {}.".format(
extension, list(self._engines.keys())
)
)
else:
Expand Down
16 changes: 8 additions & 8 deletions tests/test_markitdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def test_markitdown_pdf() -> None:
os.path.join(TEST_FILES_DIR, "2308.08155v2.pdf"),
engine="pymupdf4llm",

engine_kwargs={"show_progress": False, "pages": [i for i in range(10)],}, # additional kwargs
engine_kwargs={"show_progress": False, "pages": range(10),}, # additional kwargs
)
for test_string in PDF_TEST_STRINGS:
assert test_string in result.text_content
Expand All @@ -321,7 +321,7 @@ def test_markitdown_pdf() -> None:
"show_progress": False,
"write_images": True,
"image_path": "tests/out",
"pages": [i for i in range(10)],
"pages": range(10),
}, # `write_images` must be True, setting `image_path` for images saving dir.
)
for test_string in PDF_TEST_STRINGS:
Expand All @@ -330,16 +330,16 @@ def test_markitdown_pdf() -> None:
# By pdfminer
result = markitdown.convert(
os.path.join(TEST_FILES_DIR, "2308.08155v2.pdf"), engine="pdfminer",
enging_kwargs={"page_numbers": [i for i in range(10)],}
enging_kwargs={"page_numbers": range(10),}
)
for test_string in PDF_TEST_STRINGS:
assert test_string in result.text_content

if __name__ == "__main__":
"""Runs this file's tests from the command line."""
# test_markitdown_remote()
# test_markitdown_local()
# test_markitdown_exiftool()
# test_markitdown_deprecation()
# test_markitdown_llm()
test_markitdown_remote()
test_markitdown_local()
test_markitdown_exiftool()
test_markitdown_deprecation()
test_markitdown_llm()
test_markitdown_pdf()

0 comments on commit f07ea3e

Please sign in to comment.