File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
src/microsoft/teams/api/activities/message Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ class _MessageBase(CustomBaseModel):
7979class MessageActivity (_MessageBase , ActivityBase ):
8080 """Output model for received message activities with required fields and read-only properties."""
8181
82- text : str # pyright: ignore [reportGeneralTypeIssues, reportIncompatibleVariableOverride]
82+ text : str = "" # pyright: ignore [reportGeneralTypeIssues, reportIncompatibleVariableOverride]
8383 """The text content of the message."""
8484
8585 def is_recipient_mentioned (self ) -> bool :
Original file line number Diff line number Diff line change @@ -62,6 +62,21 @@ def test_message_activity_type_property(self):
6262 activity = self .create_message_activity ()
6363 assert activity .type == "message"
6464
65+ def test_message_activity_text_defaults_to_empty_string (self ):
66+ """Test that text field defaults to empty string in MessageActivity"""
67+ from_account = Account (id = "bot-123" , name = "Test Bot" , role = "bot" )
68+ recipient = Account (id = "user-456" , name = "Test User" , role = "user" )
69+ conversation = ConversationAccount (id = "conv-789" , conversation_type = "personal" )
70+
71+ activity = MessageActivity (
72+ id = "msg-123" ,
73+ from_ = from_account ,
74+ conversation = conversation ,
75+ recipient = recipient ,
76+ )
77+
78+ assert activity .text == ""
79+
6580 def test_add_text_method (self ):
6681 """Test adding text to the message"""
6782 activity = self .create_message_activity ("Hello" )
You can’t perform that action at this time.
0 commit comments