Skip to content

Commit 2db27bc

Browse files
Add unit tests for turn_context (#65)
* port test case from botframework for turn-context * fix model to derive from instead of * format tests with black * fix branches * change entity type to mention subtype * Revert turn_context to original * set default value for text in case that doesn't exist in a mention * all test_turn_context tests passing --------- Co-authored-by: = <=> Co-authored-by: Axel Suárez <axsuarez@microsoft.com>
1 parent 84f3230 commit 2db27bc

2 files changed

Lines changed: 424 additions & 1 deletion

File tree

libraries/Builder/microsoft-agents-builder/microsoft/agents/builder/turn_context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ def remove_mention_text(activity: Activity, identifier: str) -> str:
400400
if mention.additional_properties["mentioned"]["id"] == identifier:
401401
mention_name_match = re.match(
402402
r"<at(.*)>(.*?)<\/at>",
403-
re.escape(mention.additional_properties["text"]),
403+
re.escape(mention.additional_properties.get("text", "")),
404404
re.IGNORECASE,
405405
)
406406
if mention_name_match:

0 commit comments

Comments
 (0)