@@ -20,18 +20,6 @@ def generator_function(context):
20
20
21
21
return outputs
22
22
23
- def generator_function_rasing_ex (context ):
24
- outputs = []
25
-
26
- task1 = yield context .call_activity ("Hello" , "Tokyo" )
27
- task2 = yield context .call_activity ("Hello" , "Seattle" )
28
- task3 = yield context .call_activity ("Hello" , "London" )
29
-
30
- outputs .append (task1 )
31
- outputs .append (task2 )
32
- outputs .append (task3 )
33
-
34
- raise ValueError ("Oops!" )
35
23
36
24
def generator_function_with_serialization (context ):
37
25
"""Ochestrator to test sequential activity calls with a serializable input arguments."""
@@ -111,50 +99,17 @@ def test_failed_tokyo_state():
111
99
add_hello_failed_events (
112
100
context_builder , 0 , failed_reason , failed_details )
113
101
114
- try :
115
- result = get_orchestration_state_result (
116
- context_builder , generator_function )
117
- # expected an exception
118
- assert False
119
- except Exception as e :
120
- error_label = "\n \n $OutOfProcData$:"
121
- error_str = str (e )
122
-
123
- expected_state = base_expected_state ()
124
- add_hello_action (expected_state , 'Tokyo' )
125
- error_msg = f'{ failed_reason } \n { failed_details } '
126
- expected_state ._error = error_msg
127
- state_str = expected_state .to_json_string ()
128
-
129
- expected_error_str = f"{ error_msg } { error_label } { state_str } "
130
- assert expected_error_str == error_str
131
-
132
-
133
- def test_user_code_raises_exception ():
134
- context_builder = ContextBuilder ('test_simple_function' )
135
- add_hello_completed_events (context_builder , 0 , "\" Hello Tokyo!\" " )
136
- add_hello_completed_events (context_builder , 1 , "\" Hello Seattle!\" " )
137
- add_hello_completed_events (context_builder , 2 , "\" Hello London!\" " )
102
+ result = get_orchestration_state_result (
103
+ context_builder , generator_function )
104
+
105
+ expected_state = base_expected_state ()
106
+ add_hello_action (expected_state , 'Tokyo' )
107
+ expected_state ._error = f'{ failed_reason } \n { failed_details } '
108
+ expected = expected_state .to_json ()
109
+
110
+ assert_valid_schema (result )
111
+ assert_orchestration_state_equals (expected , result )
138
112
139
- try :
140
- result = get_orchestration_state_result (
141
- context_builder , generator_function_rasing_ex )
142
- # expected an exception
143
- assert False
144
- except Exception as e :
145
- error_label = "\n \n $OutOfProcData$:"
146
- error_str = str (e )
147
-
148
- expected_state = base_expected_state ()
149
- add_hello_action (expected_state , 'Tokyo' )
150
- add_hello_action (expected_state , 'Seattle' )
151
- add_hello_action (expected_state , 'London' )
152
- error_msg = 'Oops!'
153
- expected_state ._error = error_msg
154
- state_str = expected_state .to_json_string ()
155
-
156
- expected_error_str = f"{ error_msg } { error_label } { state_str } "
157
- assert expected_error_str == error_str
158
113
159
114
def test_tokyo_and_seattle_state ():
160
115
context_builder = ContextBuilder ('test_simple_function' )
0 commit comments