Files
ai-daily-report/tests/test_markdown_rendering.py
2026-06-04 17:12:59 +08:00

40 lines
1.3 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import unittest
from ai_daily_report.assemble import assemble_markdown
from ai_daily_report.models import NewsItem
class MarkdownRenderingTests(unittest.TestCase):
def test_blog_markdown_strips_double_blockquote_and_reference_markers(self):
items = [
NewsItem(
id="a",
source_group="AI HOT",
source_label="OpenAIBlog",
source_role="primary",
source_priority=10,
title_raw="测试模型发布",
title_norm="测试模型发布",
summary_raw="测试摘要",
title="测试模型发布",
summary="测试摘要",
url="https://openai.com/blog/test",
canonical_url="https://openai.com/blog/test",
section="模型与能力",
)
]
guide = {"theme": "> 主线判断:测试主线[1]", "threads": []}
md, _ = assemble_markdown(items, guide)
self.assertNotIn("## 导览", md)
self.assertIn("## 模型与能力", md)
self.assertIn("[OpenAIBlog ↗](https://openai.com/blog/test)", md)
self.assertNotIn("> >", md)
self.assertNotIn("[1]", md)
self.assertNotIn("主线判断", md)
if __name__ == "__main__":
unittest.main()