MCPcopy
hub / github.com/microsoft/markitdown / test_exceptions

Function test_exceptions

packages/markitdown/tests/test_module_misc.py:420–432  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

418
419
420def test_exceptions() -> None:
421 # Check that an exception is raised when trying to convert an unsupported format
422 markitdown = MarkItDown()
423 with pytest.raises(UnsupportedFormatException):
424 markitdown.convert(os.path.join(TEST_FILES_DIR, "random.bin"))
425
426 # Check that an exception is raised when trying to convert a file that is corrupted
427 with pytest.raises(FileConversionException) as exc_info:
428 markitdown.convert(
429 os.path.join(TEST_FILES_DIR, "random.bin"), file_extension=".pptx"
430 )
431 assert len(exc_info.value.attempts) == 1
432 assert type(exc_info.value.attempts[0].converter).__name__ == "PptxConverter"
433
434
435@pytest.mark.skipif(

Callers

nothing calls this directly

Calls 2

convertMethod · 0.95
MarkItDownClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…