def test_virtual_transitions_cross_module(): df = DialogueFlow("root") transitions = { "state": "root", "hello": { "state": "test", "a": {"something typical"}, "#VT(two:other)": "blah", }, } df.load_transitions(transitions) df2 = DialogueFlow("r2") transitions2 = { "not taken": { "state": "other", "score": 0, "x": { "you win": { "state": "success" } }, "y": { "you win": { "state": "success" } }, } } df2.load_transitions(transitions2) cdf = CompositeDialogueFlow("one:root", "e", "e") cdf.add_component(df, "one") cdf.add_component(df2, "two") cdf.set_state("one:root") cdf.system_turn() assert cdf.state() == ("one", "test") cdf.user_turn("x", debugging=True) assert cdf.system_turn() == "you win" assert cdf.state() == ("two", "success")
def test_virtual_transitions_cross_module(): df = DialogueFlow('root') transitions = { 'state': 'root', 'hello': { 'state': 'test', 'a': {'something typical'}, '#VT(two:other)': 'blah' } } df.load_transitions(transitions) df2 = DialogueFlow('r2') transitions2 = { 'not taken': { 'state': 'other', 'score': 0, 'x': { 'you win': { 'state': 'success' } }, 'y': { 'you win': { 'state': 'success' } } } } df2.load_transitions(transitions2) cdf = CompositeDialogueFlow('one:root', 'e', 'e') cdf.add_component(df, 'one') cdf.add_component(df2, 'two') cdf.set_state('one:root') cdf.system_turn() assert cdf.state() == ('one', 'test') cdf.user_turn('x', debugging=True) assert cdf.system_turn() == 'you win' assert cdf.state() == ('two', 'success')