from __future__ import annotations import sys from pathlib import Path from xml.etree import ElementTree as ET BACKEND_DIR = Path(__file__).resolve().parents[1] if str(BACKEND_DIR) not in sys.path: sys.path.insert(0, str(BACKEND_DIR)) from service import app as service_app # noqa: E402 def test_ai_export_outlines_chinese_svg_text() -> None: source = b''' 你好 AI ''' outlined = service_app._outline_svg_text(source) root = ET.fromstring(outlined) names = [element.tag.rsplit("}", 1)[-1] for element in root.iter()] assert "text" not in names assert names.count("path") >= 3 assert b'rotate(2 0 0)' in outlined assert b'fill="#112233"' in outlined