1
1
import os
2
- from typing import Text
3
-
4
2
from pathlib import Path
5
3
6
- import pytest
7
-
8
4
from rasa .core .test import _generate_trackers , collect_story_predictions , test
9
5
10
6
# we need this import to ignore the warning...
@@ -34,63 +30,41 @@ async def test_evaluation_image_creation(tmpdir: Path, default_agent: Agent):
34
30
assert os .path .isfile (stories_path )
35
31
36
32
37
- # TODO: this test is flaky - needs to be fixed
38
- @pytest .mark .xfail (strict = False )
39
- async def test_end_to_end_evaluation_script (restaurantbot : Text ):
40
- restaurantbot = Agent .load (restaurantbot )
33
+ async def test_end_to_end_evaluation_script (default_agent : Agent ):
41
34
completed_trackers = await _generate_trackers (
42
- END_TO_END_STORY_FILE , restaurantbot , use_e2e = True
35
+ END_TO_END_STORY_FILE , default_agent , use_e2e = True
43
36
)
44
37
45
38
story_evaluation , num_stories = collect_story_predictions (
46
- completed_trackers , restaurantbot , use_e2e = True
39
+ completed_trackers , default_agent , use_e2e = True
47
40
)
48
41
49
42
serialised_store = [
50
- "utter_ask_howcanhelp" ,
51
- "action_listen" ,
52
- "utter_ask_howcanhelp" ,
43
+ "utter_greet" ,
53
44
"action_listen" ,
54
- "utter_on_it" ,
55
- "utter_ask_cuisine" ,
45
+ "utter_greet" ,
56
46
"action_listen" ,
57
- "utter_ask_howcanhelp " ,
47
+ "utter_default " ,
58
48
"action_listen" ,
59
- "utter_on_it" ,
60
- "utter_ask_numpeople" ,
49
+ "utter_goodbye" ,
61
50
"action_listen" ,
62
- "utter_ask_moreupdates " ,
51
+ "utter_greet " ,
63
52
"action_listen" ,
64
- "utter_ask_moreupdates " ,
53
+ "utter_default " ,
65
54
"action_listen" ,
66
- "utter_ack_dosearch" ,
67
- "action_search_restaurants" ,
68
- "action_suggest" ,
69
- "action_listen" ,
70
- "utter_ask_howcanhelp" ,
71
- "action_listen" ,
72
- "greet" ,
73
55
"greet" ,
74
- "inform" ,
75
56
"greet" ,
76
- "inform" ,
77
- "inform" ,
78
- "inform" ,
79
- "deny" ,
57
+ "default" ,
58
+ "goodbye" ,
80
59
"greet" ,
81
- "[moderately](price:moderate)" ,
82
- "[east](location)" ,
83
- "[cheap](price:lo)" ,
84
- "[french](cuisine)" ,
85
- "[bombay](location)" ,
86
- "[six](people:6)" ,
87
- "[moderately](price:moderate)" ,
60
+ "default" ,
61
+ '[{"name": "Max"}](name:Max)' ,
88
62
]
89
63
90
64
assert story_evaluation .evaluation_store .serialise ()[0 ] == serialised_store
91
65
assert not story_evaluation .evaluation_store .has_prediction_target_mismatch ()
92
66
assert len (story_evaluation .failed_stories ) == 0
93
- assert num_stories == 4
67
+ assert num_stories == 3
94
68
95
69
96
70
async def test_end_to_end_evaluation_script_unknown_entity (default_agent : Agent ):
@@ -107,13 +81,13 @@ async def test_end_to_end_evaluation_script_unknown_entity(default_agent: Agent)
107
81
assert num_stories == 1
108
82
109
83
110
- async def test_end_to_evaluation_with_forms (form_bot : Agent ):
84
+ async def test_end_to_evaluation_with_forms (form_bot_agent : Agent ):
111
85
test_stories = await _generate_trackers (
112
- "examples/formbot/tests/ end-to-end-stories.md" , form_bot , use_e2e = True
86
+ "data/test_evaluations/form- end-to-end-stories.md" , form_bot_agent , use_e2e = True
113
87
)
114
88
115
89
story_evaluation , num_stories = collect_story_predictions (
116
- test_stories , form_bot , use_e2e = True
90
+ test_stories , form_bot_agent , use_e2e = True
117
91
)
118
92
119
93
assert not story_evaluation .evaluation_store .has_prediction_target_mismatch ()
0 commit comments