Example #1
0
def full_result_with_failure_info(
        status: FullExeResultStatus,
        failure_phase_step=phase_step.ASSERT__MAIN) -> FullExeResult:
    return FullExeResult(
        status, DUMMY_SDS, None,
        ActPhaseFailureInfo(
            failure_phase_step,
            FailureDetails.new_constant_message('failure message'),
            'actor name', 'phase source'))
 def test_matches(self):
     message_str = 'message'
     cases = [
         NEA('equals',
             expected=
             sut.is_failure_message_of(message_str),
             actual=
             FailureDetails.new_constant_message(message_str),
             ),
     ]
     for case in cases:
         with self.subTest(case.name):
             case.expected.apply_without_message(self, case.actual)
 def test_not_matches(self):
     cases = [
         NEA('not a ' + str(FailureDetails),
             expected=
             sut.is_failure_message_of(''),
             actual=
             'not a ' + str(FailureDetails),
             ),
         NEA('message is absent',
             expected=
             sut.is_failure_message_of(''),
             actual=
             FailureDetails.new_exception(ValueError('an exception')),
             ),
         NEA('unexpected message',
             expected=
             sut.is_failure_message_of('expected'),
             actual=
             FailureDetails.new_constant_message('actual'),
             ),
     ]
     for case in cases:
         with self.subTest(case.name):
             assert_that_assertion_fails(case.expected, case.actual)
 def test_not_matches(self):
     cases = [
         NEA('not a ' + str(FailureDetails),
             expected=
             sut.matches_exception(asrt.anything_goes()),
             actual=
             'not a ' + str(FailureDetails),
             ),
         NEA('unexpected type of exception',
             expected=
             sut.matches_exception(asrt.is_instance(ValueError)),
             actual=
             FailureDetails.new_exception(NotImplementedError('an exception')),
             ),
         NEA('exception is absent',
             expected=
             sut.matches_exception(asrt.is_not_none),
             actual=
             FailureDetails.new_constant_message('just a message'),
             ),
     ]
     for case in cases:
         with self.subTest(case.name):
             assert_that_assertion_fails(case.expected, case.actual)
Example #5
0
 def internal_error_msg(self, msg: str) -> PhaseStepFailure:
     return self.apply(ExecutionFailureStatus.INTERNAL_ERROR,
                       FailureDetails.new_constant_message(msg))