def instruction_parts_that_records_execution_steps( recorder: list) -> instruction_parts.InstructionParts: return instruction_parts.InstructionParts( SdvValidatorThat(pre_sds_action=record_value( recorder, VALIDATE_STEP_PRE_SDS_IF_APPLICABLE), post_setup_action=record_value( recorder, VALIDATE_STEP_POST_SETUP_IF_APPLICABLE)), MainStepExecutorThat( assertion_action=record_value(recorder, MAIN_STEP_AS_ASSERTION), non_assertion_action=record_value(recorder, MAIN_STEP_AS_NON_ASSERTION)))
def runTest(self): # ARRANGE # the_error_message = 'the error message' parts = instruction_parts.InstructionParts( SdvValidatorThat( post_setup_return_value=asrt_text_doc. new_single_string_text_for_test(the_error_message)), MainStepExecutorThat()) parser = self.conf.instruction_parser_from_parts_parser( PartsParserThatGives(parts)) source = remaining_source('ignored') # ACT & ASSERT # self.conf.run_test_with_parser( self, parser, source, self.conf.arrangement(), self.conf.expect_hard_error_of_main( assertion_on_error_message=asrt.equals(the_error_message)))
def runTest(self): # ARRANGE # the_error_message = 'the error message' parts = instruction_parts.InstructionParts( SdvValidatorThat(), MainStepExecutorThat( assertion_return_value=pfh.new_pfh_fail__str( the_error_message), non_assertion_return_value=sh.new_sh_hard_error__str( the_error_message))) parser = self.conf.instruction_parser_from_parts_parser( PartsParserThatGives(parts)) source = remaining_source('ignored') # ACT & ASSERT # self.conf.run_test_with_parser( self, parser, source, self.conf.arrangement(), self.conf.expect_failure_of_main( assertion_on_error_message=asrt_text_doc. is_single_pre_formatted_text_that_equals(the_error_message)))
def runTest(self): # ARRANGE # symbol_name = 'SYMBOL_NAME' string_restriction = value_restrictions.is_string() symbol_reference = SymbolReference( symbol_name, ReferenceRestrictionsOnDirectAndIndirect(string_restriction)) expected_symbol_usages = asrt.matches_sequence([ matches_symbol_reference_with_restriction_on_direct_target( symbol_name, asrt_val_rest.is__string()) ]) parts = instruction_parts.InstructionParts( SdvValidatorThat(), MainStepExecutorThat(), symbol_usages=(symbol_reference, )) parser = self.conf.instruction_parser_from_parts_parser( PartsParserThatGives(parts)) source = remaining_source('ignored') # ACT & ASSERT # self.conf.run_test_with_parser( self, parser, source, self.conf.arrangement(), self.conf.expect_success(symbol_usages=expected_symbol_usages))