mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-10-26 12:36:40 +00:00
🐛 Fix: Message.__contains__() 未考虑 bool(MessageSegment) 存在 False 情况导致的异常结果 (#2572)
Co-authored-by: Ju4tCode <42488585+yanyongyu@users.noreply.github.com>
This commit is contained in:
@@ -192,6 +192,11 @@ def test_message_contains():
|
||||
assert message.has("foo") is False
|
||||
assert "foo" not in message
|
||||
|
||||
assert not bool(FakeMessageSegment.text(""))
|
||||
msg_with_empty_seg = FakeMessage([FakeMessageSegment.text("")])
|
||||
assert msg_with_empty_seg.has("text") is True
|
||||
assert "text" in msg_with_empty_seg
|
||||
|
||||
|
||||
def test_message_only():
|
||||
message = FakeMessage(
|
||||
|
||||
Reference in New Issue
Block a user