🐛 fix DataclassEncoder bug and add test case

This commit is contained in:
AkiraXie
2022-02-17 15:06:26 +08:00
parent 9dd989c627
commit c48ddaf0a2
3 changed files with 29 additions and 1 deletions

View File

@ -32,6 +32,16 @@ def make_fake_message():
def image(url: str):
return FakeMessageSegment("image", {"url": url})
@staticmethod
def node_custom(
user_id: str,
nickname: str,
content: Union["FakeMessage", "FakeMessageSegment", str],
):
return FakeMessageSegment(
"node", {"user_id": user_id, "nickname": nickname, "content": content}
)
def is_text(self) -> bool:
return self.type == "text"