def test_fail_due_to_unexpected_result_from__validate_pre_sds(self): self._check_source_and_exe_variants__failing_assertions( PARSER_THAT_GIVES_SUCCESSFUL_INSTRUCTION, Arrangement.phase_agnostic(), MultiSourceExpectation.phase_agnostic( validation=ValidationAssertions.pre_sds_fails() ), )
def test_fail_due_to_unexpected_result_from_pre_validation(self): self._check_raises_test_error__single_and_multi( ConstantParser(_MATCHER_THAT_MATCHES), Expectation( execution=ExecutionExpectation( validation=ValidationAssertions.pre_sds_fails(), ), ) )
def runTest(self): failure_message = 'failure' failing_validation_result = asrt_validation.new_single_string_text_for_test( failure_message) line_matcher_symbol_name = 'line_matcher_with_failing_validation' asserted_symbol_references = asrt.matches_sequence( [is_reference_to_line_matcher(line_matcher_symbol_name)]) validation_cases = [ NEA('failure pre sds', expected=Expectation( ParseExpectation( symbol_references=asserted_symbol_references, ), ExecutionExpectation( validation=ValidationAssertions.pre_sds_fails( asrt.equals(failure_message)), ), ), actual=ConstantDdvValidator( pre_sds_result=failing_validation_result)), NEA('failure post sds', expected=Expectation( ParseExpectation( symbol_references=asserted_symbol_references, ), ExecutionExpectation(validation=ValidationAssertions. post_sds_fails__w_any_msg(), ), ), actual=ConstantDdvValidator( post_sds_result=failing_validation_result)), ] for case in validation_cases: symbols = LineMatcherSymbolContext.of_sdv( line_matcher_symbol_name, successful_matcher_with_validation(case.actual)).symbol_table for quantifier in Quantifier: arguments_constructor = arguments_building.ImplicitActualFileArgumentsConstructor( CommonArgumentsConstructor(), arguments_building. LineMatchesAssertionArgumentsConstructor( quantifier, line_matcher_symbol_name)) for expectation_type in ExpectationType: arguments = arguments_constructor.apply(expectation_type) source = test_configuration.arguments_for( arguments).as_remaining_source with self.subTest(case=case.name, expectation_type=expectation_type, quantifier=quantifier): self._check(source=source, model=model_constructor.arbitrary(self), arrangement=Arrangement(symbols=symbols), expectation=case.expected)
def test_SHOULD_match_WHEN_pre_sds_validation_fails_expectedly_but_primitive_value_is_unexpected( self): # ARRANGE # sdv_of_actual = RegexSdvConstantTestImpl( ARBITRARY_PATTERN, value_validator=ConstantDdvValidator( pre_sds_result=asrt_validation.new_single_string_text_for_test( 'expected failure')), ) assertion_to_check = sut.matches_regex_sdv( dir_dependencies=DirDependencies.NONE, validation=ValidationAssertions.pre_sds_fails(), primitive_value=check_of_primitive_value_fails_expectedly, ) # ACT & ASSERT # assertion_to_check.apply_without_message(self, sdv_of_actual)