def test_add_transitions(): df = DialogueFlow("States.A") df.add_system_transition("States.A", "States.B", "hello") df.add_user_transition("States.B", "States.C", "[{hi, hello, hey, [how, you]}]") df.add_user_transition("States.B", "States.D", "[{dog, cat, parrot}]") df.add_system_transition("States.D", "States.A", "so") assert df.graph().arcs() == { ("States.A", "States.B", DialogueFlow.Speaker.SYSTEM), ("States.B", "States.C", DialogueFlow.Speaker.USER), ("States.B", "States.D", DialogueFlow.Speaker.USER), ("States.D", "States.A", DialogueFlow.Speaker.SYSTEM), } assert isinstance(df.transition_natex("States.A", "States.B", Speaker.SYSTEM), NatexNLG) assert isinstance(df.transition_natex("States.B", "States.C", Speaker.USER), NatexNLU)
def test_add_transitions(): df = DialogueFlow('States.A') df.add_system_transition('States.A', 'States.B', 'hello') df.add_user_transition('States.B', 'States.C', '[{hi, hello, hey, [how, you]}]') df.add_user_transition('States.B', 'States.D', '[{dog, cat, parrot}]') df.add_system_transition('States.D', 'States.A', 'so') assert df.graph().arcs() == { ('States.A', 'States.B', DialogueFlow.Speaker.SYSTEM), ('States.B', 'States.C', DialogueFlow.Speaker.USER), ('States.B', 'States.D', DialogueFlow.Speaker.USER), ('States.D', 'States.A', DialogueFlow.Speaker.SYSTEM) } assert isinstance(df.transition_natex('States.A', 'States.B', Speaker.SYSTEM), NatexNLG) assert isinstance(df.transition_natex('States.B', 'States.C', Speaker.USER), NatexNLU)