Example #1
0
def test_domain_action_instantiation():
    domain = Domain(
        intents={},
        entities=[],
        slots=[],
        templates={},
        action_names=["my_module.ActionTest", "utter_test", "respond_test"],
        forms=[],
    )

    instantiated_actions = domain.actions(None)

    assert len(instantiated_actions) == 14
    assert instantiated_actions[0].name() == ACTION_LISTEN_NAME
    assert instantiated_actions[1].name() == ACTION_RESTART_NAME
    assert instantiated_actions[2].name() == ACTION_SESSION_START_NAME
    assert instantiated_actions[3].name() == ACTION_DEFAULT_FALLBACK_NAME
    assert instantiated_actions[4].name() == ACTION_DEACTIVATE_FORM_NAME
    assert instantiated_actions[5].name() == ACTION_REVERT_FALLBACK_EVENTS_NAME
    assert instantiated_actions[6].name(
    ) == ACTION_DEFAULT_ASK_AFFIRMATION_NAME
    assert instantiated_actions[7].name() == ACTION_DEFAULT_ASK_REPHRASE_NAME
    assert instantiated_actions[8].name() == ACTION_TWO_STAGE_FALLBACK_NAME
    assert instantiated_actions[9].name() == ACTION_BACK_NAME
    assert instantiated_actions[10].name() == RULE_SNIPPET_ACTION_NAME
    assert instantiated_actions[11].name() == "my_module.ActionTest"
    assert instantiated_actions[12].name() == "utter_test"
    assert instantiated_actions[13].name() == "respond_test"
Example #2
0
def test_domain_action_instantiation():
    domain = Domain(intent_properties={},
                    entities=[],
                    slots=[],
                    templates={},
                    action_names=["my_module.ActionTest", "utter_test"],
                    form_names=[])

    instantiated_actions = domain.actions(None)

    assert len(instantiated_actions) == 10
    assert instantiated_actions[0].name() == ACTION_LISTEN_NAME
    assert instantiated_actions[1].name() == ACTION_RESTART_NAME
    assert instantiated_actions[2].name() == ACTION_DEFAULT_FALLBACK_NAME
    assert instantiated_actions[3].name() == ACTION_DEACTIVATE_FORM_NAME
    assert instantiated_actions[4].name() == ACTION_REVERT_FALLBACK_EVENTS_NAME
    assert instantiated_actions[5].name() == (
        ACTION_DEFAULT_ASK_AFFIRMATION_NAME)
    assert instantiated_actions[6].name() == (ACTION_DEFAULT_ASK_REPHRASE_NAME)
    assert instantiated_actions[7].name() == ACTION_BACK_NAME
    assert instantiated_actions[8].name() == "my_module.ActionTest"
    assert instantiated_actions[9].name() == "utter_test"