コード例 #1
0
ファイル: test_trackers.py プロジェクト: sysang/rasa
def test_reading_of_trackers_with_legacy_form_events():
    loop_name1 = "my loop"
    loop_name2 = "my form"
    tracker = DialogueStateTracker.from_dict(
        "sender",
        events_as_dict=[
            {
                "event": ActiveLoop.type_name,
                "name": loop_name1
            },
            {
                "event": LegacyForm.type_name,
                "name": None
            },
            {
                "event": LegacyForm.type_name,
                "name": loop_name2
            },
        ],
    )

    expected_events = [
        ActiveLoop(loop_name1),
        LegacyForm(None),
        LegacyForm(loop_name2)
    ]
    assert list(tracker.events) == expected_events
    assert tracker.active_loop["name"] == loop_name2
コード例 #2
0
ファイル: test_trackers.py プロジェクト: pranavdurai10/rasa
def test_writing_trackers_with_legacy_form_events():
    loop_name = "my loop"
    tracker = DialogueStateTracker.from_events(
        "sender", evts=[ActiveLoop(loop_name), LegacyForm(None), LegacyForm("some")]
    )

    events_as_dict = [event.as_dict() for event in tracker.events]

    for event in events_as_dict:
        assert event["event"] == ActiveLoop.type_name