def test_hard_error(self): the_instruction_environment = instruction_environment.fake_post_sds_environment() the_os_services = os_services.new_default() cases = [ ( 'hard error exception in left operand', asrt_pfh.is_hard_error(asrt.equals('error error in left op')), operand_resolver_that( resolve_return_value_action=actions.do_raise(PfhHardErrorException('error error in left op'))), operand_resolver_that(), ), ( 'hard error exception in right operand', asrt_pfh.is_hard_error(asrt.equals('error error in right op')), operand_resolver_that(), operand_resolver_that( resolve_return_value_action=actions.do_raise(PfhHardErrorException('error error in right op'))), ), ] for name, result_assertion, l_op, r_op in cases: instruction_to_check = sut.Instruction(cmp_setup(l_op, r_op)) with self.subTest(name=name): # ACT # actual = instruction_to_check.main(the_instruction_environment, the_os_services) # ASSERT # result_assertion.apply_without_message(self, actual)
def new_w_defaults_of_hard_error( may_depend_on_external_resources: bool, as_str: Callable[[], str] = do_raise( HardErrorException( asrt_text_doc.new_single_string_text_for_test( 'should not be called'))), as_lines: Callable[[], Iterator[str]] = do_raise( HardErrorException( asrt_text_doc.new_single_string_text_for_test( 'should not be called'))), as_file: Callable[[DirFileSpace], Path] = do_raise( HardErrorException( asrt_text_doc.new_single_string_text_for_test( 'should not be called'))), write_to: Callable[[TextIO], None] = do_raise( HardErrorException( asrt_text_doc.new_single_string_text_for_test( 'should not be called'))), ) -> 'StringSourceContentsData': def _may_depend_on_external_resources() -> bool: return may_depend_on_external_resources return StringSourceContentsData( may_depend_on_external_resources=_may_depend_on_external_resources, as_str=as_str, as_lines=as_lines, as_file=as_file, write_to=write_to, )
def __init__(self, resolving_dependencies: Set[DirectoryStructurePartition], get_value_when_no_dir_dependencies=do_raise(_ShouldNotBeInvokedTestException()), get_value_of_any_dependency=do_raise(_ShouldNotBeInvokedTestException()), ): super().__init__(resolving_dependencies, None, get_value_when_no_dir_dependencies, get_value_of_any_dependency)
def __init__(self, resolving_dependency: Optional[DirectoryStructurePartition], value_when_no_dir_dependencies=do_raise(_ShouldNotBeInvokedTestException()), value_pre_sds=do_raise(_ShouldNotBeInvokedTestException()), value_post_sds=do_raise(_ShouldNotBeInvokedTestException()), ): self._resolving_dependency = resolving_dependency self._value_when_no_dir_dependencies = value_when_no_dir_dependencies self._value_pre_sds = value_pre_sds self._value_post_sds = value_post_sds
def test_validation_pre_sds(self): the_instruction_environment = instruction_environment.fake_pre_sds_environment() cases = [ ( 'validation should succeed when both operands succeed', asrt_svh.is_success(), operand_resolver_that(), operand_resolver_that(), ), ( 'validation exception in left operand', asrt_svh.is_validation_error(asrt.equals('error in left op')), operand_resolver_that( validate_pre_sds=actions.do_raise(SvhValidationException('error in left op'))), operand_resolver_that(), ), ( 'validation exception in right operand', asrt_svh.is_validation_error(asrt.equals('error in right op')), operand_resolver_that(), operand_resolver_that( validate_pre_sds=actions.do_raise(SvhValidationException('error in right op'))), ), ( 'hard error exception in left operand', asrt_svh.is_hard_error(asrt.equals('error in left op')), operand_resolver_that( validate_pre_sds=actions.do_raise(SvhHardErrorException('error in left op'))), operand_resolver_that(), ), ( 'hard error exception in right operand', asrt_svh.is_hard_error(asrt.equals('error in right op')), operand_resolver_that(), operand_resolver_that( validate_pre_sds=actions.do_raise(SvhHardErrorException('error in right op'))), ), ] for name, result_assertion, l_op, r_op in cases: instruction_to_check = sut.Instruction(cmp_setup(l_op, r_op)) with self.subTest(name=name): # ACT # actual = instruction_to_check.validate_pre_sds(the_instruction_environment) # ASSERT # result_assertion.apply_without_message(self, actual)
def __init__( self, resolving_dependencies: Set[DirectoryStructurePartition], get_value_when_no_dir_dependencies=do_raise( _ShouldNotBeInvokedTestException()), get_value_of_any_dependency=do_raise( _ShouldNotBeInvokedTestException()), ): super().__init__(resolving_dependencies, None, get_value_when_no_dir_dependencies, get_value_of_any_dependency)
def __init__( self, resolving_dependencies: Set[DirectoryStructurePartition], get_value_when_no_dir_dependencies: Callable[[], Any] = do_raise( _ShouldNotBeInvokedTestException()), get_value_of_any_dependency: Callable[[TestCaseDs], Any] = do_raise( _ShouldNotBeInvokedTestException()), ): self._resolving_dependencies = resolving_dependencies self._get_value_when_no_dir_dependencies = get_value_when_no_dir_dependencies self._get_value_of_any_dependency = get_value_of_any_dependency
def __init__( self, resolving_dependency: Optional[DirectoryStructurePartition], value_when_no_dir_dependencies=do_raise( _ShouldNotBeInvokedTestException()), value_pre_sds=do_raise(_ShouldNotBeInvokedTestException()), value_post_sds=do_raise(_ShouldNotBeInvokedTestException()), ): self._resolving_dependency = resolving_dependency self._value_when_no_dir_dependencies = value_when_no_dir_dependencies self._value_pre_sds = value_pre_sds self._value_post_sds = value_post_sds
def __init__(self, resolving_dependencies: Set[DirectoryStructurePartition], get_value_when_no_dir_dependencies: Callable[[], Any] = do_raise(_ShouldNotBeInvokedTestException()), get_value_of_any_dependency: Callable[[HomeAndSds], Any] = do_raise(_ShouldNotBeInvokedTestException()), ): self._resolving_dependencies = resolving_dependencies self._get_value_when_no_dir_dependencies = get_value_when_no_dir_dependencies self._get_value_of_any_dependency = get_value_of_any_dependency
def test_implementation_error_in_setup_main_step(self): test_case = TestCaseGeneratorWithExtraInstrsBetweenRecordingInstr() \ .add(PartialPhase.SETUP, test.setup_phase_instruction_that( main=do_raise(test.ImplementationErrorTestException()))) self._check( Arrangement(test_case, act_executor_execute=execute_action_that_returns_exit_code(5)), Expectation( asrt_result.matches2( PartialExeResultStatus.IMPLEMENTATION_ERROR, asrt_result.has_sds(), asrt_result.has_no_action_to_check_outcome(), ExpectedFailureForInstructionFailure.new_with_exception( phase_step.SETUP__MAIN, test_case.the_extra(PartialPhase.SETUP)[0].source, test.ImplementationErrorTestException), ), [phase_step.ACT__PARSE] + SYMBOL_VALIDATION_STEPS__TWICE + PRE_SDS_VALIDATION_STEPS__TWICE + [phase_step.SETUP__MAIN, (phase_step.CLEANUP__MAIN, PreviousPhase.SETUP), (phase_step.CLEANUP__MAIN, PreviousPhase.SETUP), ], ))
def test_internal_error(self): test_case = TestCaseGeneratorWithExtraInstrsBetweenRecordingInstr() \ .add(PartialPhase.SETUP, test.setup_phase_instruction_that( main=do_raise(test.ImplementationErrorTestException()))) self._check( Arrangement(test_case, atc_execute=execute_action_that_returns_exit_code(5)), Expectation( asrt_result.matches2( ExecutionFailureStatus.INTERNAL_ERROR, asrt_result.has_sds(), asrt_result.has_no_action_to_check_outcome(), ExpectedFailureForInstructionFailure.new_with_exception( phase_step.SETUP__MAIN, test_case.the_extra(PartialPhase.SETUP)[0].source, test.ImplementationErrorTestException), ), [phase_step.ACT__PARSE] + SYMBOL_VALIDATION_STEPS__TWICE + PRE_SDS_VALIDATION_STEPS__TWICE + [ phase_step.SETUP__MAIN, (phase_step.CLEANUP__MAIN, PreviousPhase.SETUP), (phase_step.CLEANUP__MAIN, PreviousPhase.SETUP), ], ))
def test_fail_due_to_unexpected_hard_error_exception(self): self._check_source_and_exe_variants__failing_assertions( ParserThatGives(instruction_embryo_that__phase_agnostic( main=do_raise(HardErrorException(new_single_string_text_for_test('hard error message')))) ), Arrangement.phase_agnostic(), MultiSourceExpectation.phase_agnostic( main_result=asrt.anything_goes() ), )
def new_w_defaults_of_not_impl( may_depend_on_external_resources: Callable[[], bool] = do_raise( ValueError('should not be called')), as_str: Callable[[], str] = do_raise(ValueError('should not be called')), as_lines: Callable[[], Iterator[str]] = do_raise( ValueError('should not be called')), as_file: Callable[[DirFileSpace], Path] = do_raise(ValueError('should not be called')), write_to: Callable[[TextIO], None] = do_raise( ValueError('should not be called')), ) -> 'StringSourceContentsData': return StringSourceContentsData( may_depend_on_external_resources=may_depend_on_external_resources, as_str=as_str, as_lines=as_lines, as_file=as_file, write_to=write_to, )
def test_succeed_due_to_expected_hard_error_exception(self): self._check_source_and_exe_variants( ParserThatGives(instruction_embryo_that__phase_agnostic( main=do_raise(HardErrorException(new_single_string_text_for_test('hard error message')))) ), Arrangement.phase_agnostic(), MultiSourceExpectation.phase_agnostic( main_raises_hard_error=True ), )
def new_w_default_to_raise_exception( constant_action: Callable[[bool], T] = do_raise(ValueError('constant method must not be invoked')), negation_action: Callable[[MatcherWTrace[MODEL]], T] = do_raise(ValueError('negation method must not be invoked')), conjunction_action: Callable[[Sequence[MatcherWTrace[MODEL]]], T] = do_raise(ValueError('conjunction method must not be invoked')), disjunction_action: Callable[[Sequence[MatcherWTrace[MODEL]]], T] = do_raise(ValueError('disjunction method must not be invoked')), non_standard_action: Callable[[MatcherWTrace[MODEL]], T] = do_raise(ValueError('non_standard method must not be invoked')), ) -> MatcherStdTypeVisitor[MODEL, T]: return MatcherStdTypeVisitorTestAcceptImpl( constant_action, negation_action, conjunction_action, disjunction_action, non_standard_action, )
def test_WHEN_parse_raises_unknown_exception_THEN_execution_SHOULD_stop_with_result_of_internal_error( self): # ARRANGE # step_recorder = ListRecorder() recording_atc = ActionToCheckWrapperThatRecordsSteps( step_recorder, _atc_that_does_nothing()) actor = ActorForConstantAtc(recording_atc, parse_atc=do_raise( ValueError('failure message'))) arrangement = Arrangement(test_case=_empty_test_case(), actor=actor) # ASSERT # expectation = Expectation(phase_result=asrt_result.status_is( ExecutionFailureStatus.INTERNAL_ERROR)) # APPLY # execute_and_check(self, arrangement, expectation) self.assertEqual([], step_recorder.recorded_elements, 'executed steps')
def test_with_internal_error(self): test_case = test_case_with_two_instructions_in_each_phase() \ .add(phase_identifier.CONFIGURATION, test.ConfigurationPhaseInstructionThatSetsExecutionMode(TestCaseStatus.FAIL)) \ .add(phase_identifier.CLEANUP, test.cleanup_phase_instruction_that( main=do_raise(test.ImplementationErrorTestException()))) self._check( Arrangement( test_case, execute_test_action=execute_action_that_returns_exit_code( 128)), Expectation( asrt_result.matches2( FullExeResultStatus.INTERNAL_ERROR, asrt_result.has_sds(), asrt_result.has_action_to_check_outcome_with_exit_code( 128), ExpectedFailureForInstructionFailure.new_with_exception( phase_step.CLEANUP__MAIN, test_case.the_extra( phase_identifier.CLEANUP)[0].source, test.ImplementationErrorTestException), ), [ phase_step.CONFIGURATION__MAIN, phase_step.CONFIGURATION__MAIN ] + [phase_step.ACT__PARSE] + SYMBOL_VALIDATION_STEPS__TWICE + PRE_SDS_VALIDATION_STEPS__TWICE + [ phase_step.SETUP__MAIN, phase_step.SETUP__MAIN, phase_step.SETUP__VALIDATE_POST_SETUP, phase_step.SETUP__VALIDATE_POST_SETUP, phase_step.ACT__VALIDATE_POST_SETUP, phase_step.BEFORE_ASSERT__VALIDATE_POST_SETUP, phase_step.BEFORE_ASSERT__VALIDATE_POST_SETUP, phase_step.ASSERT__VALIDATE_POST_SETUP, phase_step.ASSERT__VALIDATE_POST_SETUP, phase_step.ACT__PREPARE, phase_step.ACT__EXECUTE, phase_step.BEFORE_ASSERT__MAIN, phase_step.BEFORE_ASSERT__MAIN, phase_step.ASSERT__MAIN, phase_step.ASSERT__MAIN, (phase_step.CLEANUP__MAIN, PreviousPhase.ASSERT), ], ))
def test_with_implementation_error(self): test_case = test_case_with_two_instructions_in_each_phase() \ .add(phase_identifier.CONFIGURATION, test.ConfigurationPhaseInstructionThatSetsExecutionMode(TestCaseStatus.FAIL)) \ .add(phase_identifier.CLEANUP, test.cleanup_phase_instruction_that( main=do_raise(test.ImplementationErrorTestException()))) self._check( Arrangement(test_case, execute_test_action=execute_action_that_returns_exit_code(128)), Expectation( asrt_result.matches2( FullExeResultStatus.IMPLEMENTATION_ERROR, asrt_result.has_sds(), asrt_result.has_action_to_check_outcome_with_exit_code(128), ExpectedFailureForInstructionFailure.new_with_exception( phase_step.CLEANUP__MAIN, test_case.the_extra(phase_identifier.CLEANUP)[0].source, test.ImplementationErrorTestException), ), [phase_step.CONFIGURATION__MAIN, phase_step.CONFIGURATION__MAIN] + [phase_step.ACT__PARSE] + SYMBOL_VALIDATION_STEPS__TWICE + PRE_SDS_VALIDATION_STEPS__TWICE + [phase_step.SETUP__MAIN, phase_step.SETUP__MAIN, phase_step.SETUP__VALIDATE_POST_SETUP, phase_step.SETUP__VALIDATE_POST_SETUP, phase_step.ACT__VALIDATE_POST_SETUP, phase_step.BEFORE_ASSERT__VALIDATE_POST_SETUP, phase_step.BEFORE_ASSERT__VALIDATE_POST_SETUP, phase_step.ASSERT__VALIDATE_POST_SETUP, phase_step.ASSERT__VALIDATE_POST_SETUP, phase_step.ACT__PREPARE, phase_step.ACT__EXECUTE, phase_step.BEFORE_ASSERT__MAIN, phase_step.BEFORE_ASSERT__MAIN, phase_step.ASSERT__MAIN, phase_step.ASSERT__MAIN, (phase_step.CLEANUP__MAIN, PreviousPhase.ASSERT), ], ))
def test_implementation_error_in_configuration_phase(self): test_case = test_case_with_two_instructions_in_each_phase() \ .add(phase_identifier.CONFIGURATION, test.configuration_phase_instruction_that( main=do_raise(test.ImplementationErrorTestException()))) self._check( Arrangement(test_case), Expectation( asrt_result.matches2( FullExeResultStatus.IMPLEMENTATION_ERROR, asrt_result.has_no_sds(), asrt_result.has_no_action_to_check_outcome(), ExpectedFailureForInstructionFailure.new_with_exception( phase_step.CONFIGURATION__MAIN, test_case.the_extra(phase_identifier.CONFIGURATION)[0].source, test.ImplementationErrorTestException), ), [phase_step.CONFIGURATION__MAIN], ))
def test_implementation_error_in_validate_symbols(self): test_case = _single_successful_instruction_in_each_phase() self._check( Arrangement(test_case, act_executor_symbol_usages=do_raise(test.ImplementationErrorTestException())), Expectation( asrt_result.matches2(PartialExeResultStatus.IMPLEMENTATION_ERROR, asrt_result.has_no_sds(), asrt_result.has_no_action_to_check_outcome(), ExpectedFailureForPhaseFailure.new_with_exception( phase_step.ACT__VALIDATE_SYMBOLS, test.ImplementationErrorTestException) ), [ phase_step.ACT__PARSE, phase_step.SETUP__VALIDATE_SYMBOLS, phase_step.ACT__VALIDATE_SYMBOLS, ], ))
def test_WHEN_parse_raises_unknown_exception_THEN_execution_SHOULD_stop_with_result_of_implementation_error(self): # ARRANGE # expected_cause = svh.new_svh_validation_error('failure message') atc_that_does_nothing = ActionToCheckThatRunsConstantActions() step_recorder = ListRecorder() recording_atc = ActionToCheckWrapperThatRecordsSteps(step_recorder, atc_that_does_nothing) actor = ActorForConstantAtc( recording_atc, parse_atc=do_raise(ValueError(expected_cause)) ) arrangement = Arrangement(test_case=_empty_test_case(), actor=actor) # ASSERT # expectation = Expectation(phase_result=asrt_result.status_is(PartialExeResultStatus.IMPLEMENTATION_ERROR)) # APPLY # execute_and_check(self, arrangement, expectation) self.assertEqual([], step_recorder.recorded_elements, 'executed steps')
def test_internal_error_in_validate_symbols(self): test_case = _single_successful_instruction_in_each_phase() self._check( Arrangement(test_case, atc_symbol_usages=do_raise( test.ImplementationErrorTestException())), Expectation( asrt_result.matches2( ExecutionFailureStatus.INTERNAL_ERROR, asrt_result.has_no_sds(), asrt_result.has_no_action_to_check_outcome(), ExpectedFailureForPhaseFailure.new_with_exception( phase_step.ACT__VALIDATE_SYMBOLS, test.ImplementationErrorTestException)), [ phase_step.ACT__PARSE, phase_step.SETUP__VALIDATE_SYMBOLS, phase_step.ACT__VALIDATE_SYMBOLS, ], ))
def test_hard_error_exception(self): test_case = TestCaseGeneratorWithExtraInstrsBetweenRecordingInstr() \ .add(PartialPhase.CLEANUP, test.cleanup_phase_instruction_that( main=do_raise(hard_error_ex('hard error exception msg from CLEANUP')))) self._check( Arrangement(test_case, atc_execute=execute_action_that_returns_exit_code(3)), Expectation( asrt_result.matches2( ExecutionFailureStatus.HARD_ERROR, asrt_result.has_sds(), asrt_result.has_action_to_check_outcome_with_exit_code(3), ExpectedFailureForInstructionFailure.new_with_message( phase_step.CLEANUP__MAIN, test_case.the_extra(PartialPhase.CLEANUP)[0].source, 'hard error exception msg from CLEANUP'), ), [phase_step.ACT__PARSE] + SYMBOL_VALIDATION_STEPS__TWICE + PRE_SDS_VALIDATION_STEPS__TWICE + [ phase_step.SETUP__MAIN, phase_step.SETUP__MAIN, phase_step.SETUP__VALIDATE_POST_SETUP, phase_step.SETUP__VALIDATE_POST_SETUP, phase_step.ACT__VALIDATE_POST_SETUP, phase_step.BEFORE_ASSERT__VALIDATE_POST_SETUP, phase_step.BEFORE_ASSERT__VALIDATE_POST_SETUP, phase_step.ASSERT__VALIDATE_POST_SETUP, phase_step.ASSERT__VALIDATE_POST_SETUP, phase_step.ACT__VALIDATE_EXE_INPUT, phase_step.ACT__PREPARE, phase_step.ACT__EXECUTE, phase_step.BEFORE_ASSERT__MAIN, phase_step.BEFORE_ASSERT__MAIN, phase_step.ASSERT__MAIN, phase_step.ASSERT__MAIN, (phase_step.CLEANUP__MAIN, PreviousPhase.ASSERT), ], ))
def test_hard_error_exception_from_executor_execute_SHOULD_be_handled( self): # ARRANGE # act_phase_instructions = [] hard_error_message = 'the err msg' actor = sut.ActorFromParts( ParserWithConstantResult(SymbolUserWithConstantSymbolReferences( ())), sut.UnconditionallySuccessfulValidatorConstructor(), _ExecutorConstructorForConstant( ExecutorThat(execute_initial_action=do_raise( HardErrorException( asrt_text_doc.new_single_string_text_for_test( hard_error_message))))), ) arrangement = arrangement_w_tcds() expectation = Expectation.hard_error_from_execute( error_message=asrt_text_doc. is_single_pre_formatted_text_that_equals(hard_error_message)) # ACT & ASSERT # check_execution(self, actor, act_phase_instructions, arrangement, expectation)
def test_hard_error_exception(self): test_case = TestCaseGeneratorWithExtraInstrsBetweenRecordingInstr() \ .add(PartialPhase.SETUP, test.setup_phase_instruction_that( main=do_raise(hard_error_ex('hard error exception msg from setup')))) self._check( Arrangement(test_case), Expectation( asrt_result.matches2( ExecutionFailureStatus.HARD_ERROR, asrt_result.has_sds(), asrt_result.has_no_action_to_check_outcome(), ExpectedFailureForInstructionFailure.new_with_message( phase_step.SETUP__MAIN, test_case.the_extra(PartialPhase.SETUP)[0].source, 'hard error exception msg from setup'), ), [phase_step.ACT__PARSE] + SYMBOL_VALIDATION_STEPS__TWICE + PRE_SDS_VALIDATION_STEPS__TWICE + [ phase_step.SETUP__MAIN, (phase_step.CLEANUP__MAIN, PreviousPhase.SETUP), (phase_step.CLEANUP__MAIN, PreviousPhase.SETUP), ], ))
def before_assert_instr_setup(self) -> SingleInstructionSetup: return instr_setup( instr.before_assert_phase_instruction_that( main_initial_action=do_raise(ImplementationError())))
def cleanup_instr_setup(self) -> SingleInstructionSetup: return instr_setup( instr.cleanup_phase_instruction_that( main_initial_action=do_raise(ImplementationError())))
def instruction_that_raises(self, exception: Exception) -> TestCaseInstruction: return test.before_assert_phase_instruction_that(validate_post_setup=do_raise(exception))
def before_assert_instr_setup(self) -> SingleInstructionSetup: return instr_setup(instr.before_assert_phase_instruction_that( main_initial_action=do_raise(ImplementationError()) ))
def instruction_that_raises(self, exception: Exception) -> TestCaseInstruction: return test.assert_phase_instruction_that(validate_pre_sds=do_raise(exception))
def instruction_that_raises(self, exception: Exception) -> TestCaseInstruction: return test.before_assert_phase_instruction_that( validate_post_setup=do_raise(exception))
def instruction_that_raises(self, exception: Exception) -> TestCaseInstruction: return test.assert_phase_instruction_that(validate_pre_sds=do_raise(exception))
def first_line_should_be_exit_identifier(put: unittest.TestCase, output: str, expected_exit_value: ExitValue): lines = output.split() put.assertTrue( len(lines) > 0, 'There should be at least one line (found {})'.format(len(lines))) first_line = lines[0] put.assertEqual(expected_exit_value.exit_identifier, first_line, 'first line') DO_RAISES_EXCEPTION = do_raise(ValueError('implementation error msg')) SVH_VALIDATION_ERROR = do_return( svh.new_svh_validation_error__str('validation error msg')) SVH_HARD_ERROR = do_return(svh.new_svh_hard_error__str('hard error msg')) SH_HARD_ERROR = do_return(sh.new_sh_hard_error__str('hard error msg')) def output_is_sds_which_should_be_preserved( sds_dir_name: str) -> Assertion[str]: return asrt.and_([ IsExistingDir(sds_dir_name), asrt.equals(sds_dir_name + '\n'), ])
def instruction_that_raises(self, exception: Exception) -> TestCaseInstruction: return test.cleanup_phase_instruction_that(symbol_usages=do_raise(exception))
def first_line_should_be_exit_identifier(put: unittest.TestCase, output: str, expected_exit_value: ExitValue): lines = output.split() put.assertTrue(len(lines) > 0, 'There should be at least one line (found {})'.format(len(lines))) first_line = lines[0] put.assertEqual(expected_exit_value.exit_identifier, first_line, 'first line') DO_RAISES_EXCEPTION = do_raise(ValueError('implementation error msg')) SVH_VALIDATION_ERROR = do_return(svh.new_svh_validation_error('validation error msg')) SVH_HARD_ERROR = do_return(svh.new_svh_hard_error('hard error msg')) SH_HARD_ERROR = do_return(sh.new_sh_hard_error('hard error msg')) def output_is_sds_which_should_be_preserved(sds_dir_name: str) -> ValueAssertion[str]: return asrt.and_([ IsExistingDir(sds_dir_name), asrt.equals(sds_dir_name + '\n'), ]) def output_is_empty(sds_dir_name: str) -> ValueAssertion[str]:
def instruction_that_raises(self, exception: Exception) -> TestCaseInstruction: return test.before_assert_phase_instruction_that(symbol_usages=do_raise(exception))
def cleanup_instr_setup(self) -> SingleInstructionSetup: return instr_setup(instr.cleanup_phase_instruction_that( main_initial_action=do_raise(ImplementationError()) ))
def instruction_that_raises(self, exception: Exception) -> TestCaseInstruction: return test.before_assert_phase_instruction_that(symbol_usages=do_raise(exception))
def instruction_that_raises(self, exception: Exception) -> TestCaseInstruction: return test.cleanup_phase_instruction_that(symbol_usages=do_raise(exception))