# Copyright (c) 2025 Patrick Motsch # All rights reserved. import pytest from modules.serviceCenter.services.serviceGeneration.subDocumentUtility import markdownToDocumentJson def test_inline_image_in_paragraph(): md = "Results show ![chart](file:abc \"200pt\") clearly." result = markdownToDocumentJson(md, "Test") runs = result["documents"][0]["sections"][0]["elements"][0]["content"]["inlineRuns"] types = [r["type"] for r in runs] assert "text" in types assert "image" in types imgRun = next(r for r in runs if r["type"] == "image") assert imgRun.get("fileId") == "abc" def test_multiple_inline_images(): md = "A ![x](file:1) B ![y](file:2) C" result = markdownToDocumentJson(md, "Test") runs = result["documents"][0]["sections"][0]["elements"][0]["content"]["inlineRuns"] images = [r for r in runs if r["type"] == "image"] assert len(images) == 2