From 1a6064a7529eca9145315443aa1a6bdf99ebad1e Mon Sep 17 00:00:00 2001 From: Aviral Bhardwaj <152312896+aviralbhardwaj007@users.noreply.github.com> Date: Tue, 17 Dec 2024 18:48:23 +0530 Subject: [PATCH] resolving conflict after adding the new lines from merged code --- tests/test_markitdown.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/test_markitdown.py b/tests/test_markitdown.py index 5be2063..58dcd7c 100644 --- a/tests/test_markitdown.py +++ b/tests/test_markitdown.py @@ -51,6 +51,17 @@ DOCX_TEST_STRINGS = [ "AutoGen: Enabling Next-Gen LLM Applications via Multi-Agent Conversation", ] +DOCX_COMMENT_TEST_STRINGS = [ + "314b0a30-5b04-470b-b9f7-eed2c2bec74a", + "49e168b7-d2ae-407f-a055-2167576f39a1", + "## d666f1f7-46cb-42bd-9a39-9a39cf2a509f", + "# Abstract", + "# Introduction", + "AutoGen: Enabling Next-Gen LLM Applications via Multi-Agent Conversation", + "This is a test comment. 12df-321a", + "Yet another comment in the doc. 55yiyi-asd09", +] + DOC_TEST_STRINGS = [ "314b0a30-5b04-470b-b9f7-eed2c2bec74a", "49e168b7-d2ae-407f-a055-2167576f39a1", @@ -138,6 +149,23 @@ def test_markitdown_local() -> None: for test_string in DOCX_TEST_STRINGS: text_content = result.text_content.replace("\\", "") assert test_string in text_content + # Test DOCX processing, with comments + result = markitdown.convert( + os.path.join(TEST_FILES_DIR, "test_with_comment.docx"), + style_map="comment-reference => ", + ) + for test_string in DOCX_COMMENT_TEST_STRINGS: + text_content = result.text_content.replace("\\", "") + assert test_string in text_content + + # Test DOCX processing, with comments and setting style_map on init + markitdown_with_style_map = MarkItDown(style_map="comment-reference => ") + result = markitdown_with_style_map.convert( + os.path.join(TEST_FILES_DIR, "test_with_comment.docx") + ) + for test_string in DOCX_COMMENT_TEST_STRINGS: + text_content = result.text_content.replace("\\", "") + assert test_string in text_content # Test DOC processing result = markitdown.convert(os.path.join(TEST_FILES_DIR, "test.doc"))