23 lines
908 B
Python
23 lines
908 B
Python
# 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  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  B  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
|