Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re: Added comments in tracker event assertion code block #80

Merged
merged 3 commits into from
Jun 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions tests/knowledge_base/test_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,16 @@ async def test_action_run(data_file, latest_message, slots, expected_slots):

# Check that temporary slot setting by action is correct.
if any(initial_slots.values()):
# The condition block below checks for user message
# such as "what is the price range of Pasta Bar?".
# This user message example is denoted by test case `4`.
if (
initial_slots.get(SLOT_OBJECT_TYPE) is None
and initial_slots.get(SLOT_MENTION) is None
):
# Since Pasta Bar belongs to `restaurant` object type
# the tracker event passed to set the slot temporarily
# should look like this.
expected_tracker_event = {
"event": "slot",
"timestamp": None,
Expand All @@ -216,10 +222,17 @@ async def test_action_run(data_file, latest_message, slots, expected_slots):

assert expected_tracker_event in tracker.events

# The condition block below checks for user message
# such as "what is the cuisine of second one?".
# This user message example is denoted by test case `3`.
elif (
initial_slots.get(SLOT_OBJECT_TYPE) is None
and initial_slots.get(SLOT_MENTION) is not None
):
# Since there is no `restaurant` entity in the user message,
# the `object_type` will be `None`.
# Therefore, the tracker event passed to set the slot temporarily
# should look like this.
expected_tracker_event = {
"event": "slot",
"timestamp": None,
Expand Down