Skip to content

Commit

Permalink
split test
Browse files Browse the repository at this point in the history
  • Loading branch information
Tawakalt committed Apr 13, 2023
1 parent 15d9c90 commit 1d99564
Showing 1 changed file with 40 additions and 3 deletions.
43 changes: 40 additions & 3 deletions tests/shared/core/test_slot_mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,18 +169,55 @@ def test_slot_mappings_check_mapping_validity_from_intent():
)


def test_slot_mappings_check_mapping_validity_valid_intent_list():
slot_name = "mood"
domain = Domain.from_yaml(
f"""
version: "{LATEST_TRAINING_DATA_FORMAT_VERSION}"
intents:
- greet
- goodbye
- mood_great
- mood_unhappy
slots:
{slot_name}:
type: any
influence_conversation: false
mappings:
- type: from_intent
value: "testing 123"
intent:
- goodbye
- mood_great
- greet
forms:
test_form:
required_slots:
- test_slot
"""
)
mappings_for_slot = domain.as_dict().get("slots").get(slot_name).get("mappings")
assert SlotMapping.check_mapping_validity(
slot_name=slot_name,
mapping_type=SlotMappingType.FROM_INTENT,
mapping=mappings_for_slot[0],
domain=domain,
)


@pytest.mark.parametrize(
"intent, expected",
[
(["goodbye", "mood_great", "greet"], True),
(["a", "b", "c"], False),
([], True),
("", True),
({}, True),
(None, False),
("null", True),
],
)
def test_slot_mappings_check_mapping_validity_intent_list(intent: Text, expected: bool):
def test_slot_mappings_check_mapping_validity_invalid_intent_list(
intent: Text, expected: bool
):
slot_name = "mood"
domain = Domain.from_yaml(
f"""
Expand Down

0 comments on commit 1d99564

Please sign in to comment.