@@ -56,7 +56,7 @@ class PreviousPhases(enum.Enum):
56
56
ALL = 'ALL'
57
57
58
58
# Check all previous phases in the current subtest.
59
- SUBTEST = " SUBTEST"
59
+ SUBTEST = ' SUBTEST'
60
60
61
61
62
62
def _not_any (iterable : Iterator [bool ]) -> bool :
@@ -183,20 +183,19 @@ def apply_to_all_phases(
183
183
return self
184
184
185
185
def get_result (
186
- self ,
187
- running_test_state : 'test_state.TestState' ,
188
- subtest_rec : Optional [test_record .SubtestRecord ] = None
186
+ self ,
187
+ running_test_state : 'test_state.TestState' ,
188
+ subtest_rec : Optional [test_record .SubtestRecord ] = None
189
189
) -> phase_descriptor .PhaseReturnT :
190
190
if self ._check_for_action (running_test_state , subtest_rec ):
191
191
return self .action
192
192
return phase_descriptor .PhaseResult .CONTINUE
193
193
194
194
@abc .abstractmethod
195
195
def _check_for_action (
196
- self ,
197
- running_test_state : 'test_state.TestState' ,
198
- subtest_rec : Optional [test_record .SubtestRecord ] = None
199
- ) -> bool :
196
+ self ,
197
+ running_test_state : 'test_state.TestState' ,
198
+ subtest_rec : Optional [test_record .SubtestRecord ] = None ) -> bool :
200
199
"""Returns True when the action should be taken."""
201
200
202
201
@abc .abstractmethod
@@ -244,20 +243,19 @@ def _phase_failed(self, phase_rec: test_record.PhaseRecord) -> bool:
244
243
return phase_rec .outcome == test_record .PhaseOutcome .FAIL
245
244
246
245
def _check_for_action (
247
- self ,
248
- running_test_state : 'test_state.TestState' ,
249
- subtest_rec : Optional [test_record .SubtestRecord ] = None
250
- ) -> bool :
246
+ self ,
247
+ running_test_state : 'test_state.TestState' ,
248
+ subtest_rec : Optional [test_record .SubtestRecord ] = None ) -> bool :
251
249
"""Returns True when the specific set of phases fail."""
252
250
phase_records = running_test_state .test_record .phases
253
251
if not phase_records :
254
252
raise NoPhasesFoundError ('No phases found in the test record.' )
255
253
if self .previous_phases_to_check == PreviousPhases .LAST :
256
254
return self ._phase_failed (phase_records [- 1 ])
257
- elif (self .previous_phases_to_check == PreviousPhases .SUBTEST and
255
+ elif (self .previous_phases_to_check == PreviousPhases .SUBTEST and
258
256
subtest_rec is not None ):
259
257
for phase_rec in phase_records :
260
- if (phase_rec .subtest_name == subtest_rec .name and
258
+ if (phase_rec .subtest_name == subtest_rec .name and
261
259
self ._phase_failed (phase_rec )):
262
260
return True
263
261
else :
@@ -286,10 +284,9 @@ def _asdict(self) -> Dict[Text, Any]:
286
284
return ret
287
285
288
286
def _check_for_action (
289
- self ,
290
- running_test_state : 'test_state.TestState' ,
291
- subtest_rec : Optional [test_record .SubtestRecord ] = None
292
- ) -> bool :
287
+ self ,
288
+ running_test_state : 'test_state.TestState' ,
289
+ subtest_rec : Optional [test_record .SubtestRecord ] = None ) -> bool :
293
290
"""Returns True if the condition is true."""
294
291
return self .diag_condition .check (running_test_state .diagnoses_manager .store )
295
292
0 commit comments