Skip to content

Commit

Permalink
test(renderer): add renderer tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fu050409 committed Mar 3, 2024
1 parent 8747ead commit a427e8e
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions tests/test_renderer.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from diceutils.renderer import Renderer, Messages, Role
from diceutils.renderer.html import HTMLRenderer


def test_render():
messages = Messages()
msg_content_1 = [
{"type": "text", "data": {"text": "“你好”,PC顿了顿道,“非常好”"}},
{"type": "image", "data": {"url": "http://a.com/1.png"}},
]
msg_content_2 = [
{
Expand All @@ -16,12 +16,18 @@ def test_render():
},
{"type": "image", "data": {"url": "http://a.com/2.png"}},
]
messages.add_message("230234235", Role.GM, "苏向夜", "date", msg_content_1)
messages.add_message("130324324", Role.PL, "少年狐", "date", msg_content_1)
messages.add_message("120232412", Role.PL, "Aruvelut", "date", msg_content_2)
messages.add_message(
"1302425", Role.PL, "张三", "datetime.datetime.now()", msg_content_1
)
messages.add_message(
"1302425", Role.PL, "张三", "datetime.datetime.now()", msg_content_2
"130232542",
Role.OB,
"简律纯",
"datetime.datetime.now()",
[
{"type": "text", "data": {"text": "谴责!"}},
],
)

# renderer = Renderer.render(messages, DocxRenderer())
# renderer.export()
renderer = Renderer.render(messages, HTMLRenderer())
renderer.export("测试")

0 comments on commit a427e8e

Please sign in to comment.