Skip to content

Commit

Permalink
hide_rule_turn should default to False when ActionExecuted is d…
Browse files Browse the repository at this point in the history
…eserialised. (#9491)

* hide_rule_turn should default to False when ActionExecuted is deserialised.

* add changelog

* black
  • Loading branch information
joejuzl authored Sep 1, 2021
1 parent 0d97d42 commit e389c6c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog/9490.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixes bug where `hide_rule_turn` was defaulting to `None` when ActionExecuted was deserialised.
2 changes: 1 addition & 1 deletion rasa/shared/core/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -1562,7 +1562,7 @@ def _from_story_string(cls, parameters: Dict[Text, Any]) -> Optional[List[Event]
parameters.get("timestamp"),
parameters.get("metadata"),
parameters.get("action_text"),
parameters.get("hide_rule_turn"),
parameters.get("hide_rule_turn", False),
)
]

Expand Down
14 changes: 14 additions & 0 deletions tests/shared/core/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,20 @@ def test_json_parse_user():
)


def test_json_parse_action_executed_with_no_hide_rule():
evt = {
"event": "action",
"name": "action_listen",
"policy": None,
"confidence": None,
"timestamp": None,
}
deserialised: ActionExecuted = Event.from_parameters(evt)
expected = ActionExecuted("action_listen",)
assert deserialised == expected
assert deserialised.hide_rule_turn == expected.hide_rule_turn


def test_json_parse_bot():
evt = {"event": "bot", "text": "Hey there!", "data": {}}
assert Event.from_parameters(evt) == BotUttered("Hey there!", {})
Expand Down

0 comments on commit e389c6c

Please sign in to comment.