Esempio n. 1
0
def _application_result_check_cases(parser: Parser[MatcherSdv[int]],
                                    ) -> List[NameAndValue[IntegrationCheckerForTest]]:
    return [
        NameAndValue(
            'check_application_result_with_tcds:False',
            sut.IntegrationChecker(parser, CONFIGURATION, False),
        ),
        NameAndValue(
            'check_application_result_with_tcds:True',
            sut.IntegrationChecker(parser, CONFIGURATION, True),
        ),
    ]
Esempio n. 2
0
    def _check_raises_test_error__single_and_multi(self,
                                                   parser: Parser[MatcherSdv[int]],
                                                   expectation: Expectation,
                                                   ):
        for check_application_result_with_tcds in [False, True]:
            checker = sut.IntegrationChecker(parser, CONFIGURATION, check_application_result_with_tcds)
            for arrangement in _EMPTY_ARRANGEMENT_W_WO_TCDS:
                with self.subTest(arrangement.name,
                                  check_application_result_with_tcds=check_application_result_with_tcds,
                                  execution_variant='single execution'):
                    with self.assertRaises(utils.TestError):
                        self._check(
                            utils.single_line_source(),
                            ARBITRARY_MODEL,
                            checker,
                            arrangement.value,
                            expectation,
                        )

                with self.subTest(arrangement.name,
                                  check_application_result_with_tcds=check_application_result_with_tcds,
                                  execution_variant='multiple execution'):
                    with self.assertRaises(utils.TestError):
                        self._check___multi(
                            utils.single_line_arguments(),
                            ARBITRARY_MODEL,
                            checker,
                            arrangement.value,
                            expectation,
                        )
Esempio n. 3
0
def checker(
    accepted_file_relativities: RelOptionsConfiguration
) -> integration_check.IntegrationChecker[StringSource, None, None]:
    return integration_check.IntegrationChecker(
        parse.string_source_parser(accepted_file_relativities),
        StringSourcePropertiesConfiguration(),
        check_application_result_with_tcds=False,
    )
Esempio n. 4
0
    def test_fail_due_to_unsatisfied_assertion_on_output_from_application(self):
        matcher_result_value = True
        for check_application_result_with_tcds in [False, True]:
            parser = _constant_line_matcher_type_parser_of_matcher_sdv(
                sdv_ddv.sdv_from_primitive_value(constant.MatcherWithConstantResult(matcher_result_value))
            )
            checker = sut.IntegrationChecker(
                parser,
                _CustomMatcherPropertiesConfiguration(asrt_matching_result.matches_value(not matcher_result_value)),
                check_application_result_with_tcds,
            )

            expectation = is_expectation_of_execution_result_of(matcher_result_value)
            for arrangement in _EMPTY_ARRANGEMENT_W_WO_TCDS:
                with self.subTest(arrangement.name,
                                  check_application_result_with_tcds=check_application_result_with_tcds,
                                  execution_variant='single execution'):
                    with self.assertRaises(utils.TestError):
                        self._check(
                            utils.single_line_source(),
                            ARBITRARY_MODEL,
                            checker,
                            arrangement.value,
                            expectation,
                        )

                with self.subTest(arrangement.name,
                                  check_application_result_with_tcds=check_application_result_with_tcds,
                                  execution_variant='multiple execution'):
                    with self.assertRaises(utils.TestError):
                        self._check___multi(
                            utils.single_line_arguments(),
                            ARBITRARY_MODEL,
                            checker,
                            arrangement.value,
                            expectation,
                        )
Esempio n. 5
0
        return file_matcher_models.new_model__of_described(
            ddv.value_of_any_dependency__d(environment.tcds))

    return ret_val


def file_in_tcds(relativity: RelOptionType,
                 file_name: str) -> ModelConstructor:
    def ret_val(environment: FullResolvingEnvironment) -> FileMatcherModel:
        ddv = path_ddvs.of_rel_option(relativity,
                                      path_ddvs.constant_path_part(file_name))
        return file_matcher_models.new_model__of_described(
            ddv.value_of_any_dependency__d(environment.tcds))

    return ret_val


ARBITRARY_MODEL = constant_relative_file_name('arbitrary-file.txt')

CHECKER__PARSE_FULL = integration_check.IntegrationChecker(
    parse_file_matcher.parsers().full,
    MatcherPropertiesConfiguration(),
    False,
)

CHECKER__PARSE_SIMPLE = integration_check.IntegrationChecker(
    parse_file_matcher.parsers().simple,
    MatcherPropertiesConfiguration(),
    False,
)
Esempio n. 6
0
from exactly_lib.impls.types.files_condition import parse
from exactly_lib_test.impls.types.logic.test_resources import integration_check
from exactly_lib_test.type_val_deps.types.files_condition.test_resources.properties_checker import \
    FilesConditionPropertiesConfiguration

CHECKER = integration_check.IntegrationChecker(
    parse.parsers().full,
    FilesConditionPropertiesConfiguration(),
    check_application_result_with_tcds=False,
)
Esempio n. 7
0
from exactly_lib.impls.types.program.parse import parse_program as sut
from exactly_lib_test.impls.types.logic.test_resources import integration_check
from exactly_lib_test.impls.types.program.test_resources import integration_check_config
from exactly_lib_test.type_val_deps.dep_variants.full_deps.test_resources import common_properties_checker

CHECKER_WO_EXECUTION = integration_check.IntegrationChecker(
    sut.program_parser(),
    integration_check_config.ProgramPropertiesConfiguration(
        common_properties_checker.ApplierThatDoesNothing(),
    ),
    True,
)
Esempio n. 8
0
    ExecutionExpectation, prim_asrt__constant, adv_asrt__any, AssertionResolvingEnvironment, MultiSourceExpectation
from exactly_lib_test.impls.types.string_transformer.test_resources.transformer_checker import \
    StringTransformerPropertiesConfiguration
from exactly_lib_test.section_document.test_resources import parse_checker
from exactly_lib_test.test_resources.value_assertions import value_assertion as asrt
from exactly_lib_test.test_resources.value_assertions.value_assertion import Assertion
from exactly_lib_test.type_val_prims.string_source.test_resources import assertions as asrt_string_source
from exactly_lib_test.type_val_prims.string_transformer.test_resources import \
    string_transformer_assertions as asrt_string_transformer

StExpectation = Expectation[StringTransformer, StringSource]
StMultiSourceExpectation = MultiSourceExpectation[StringTransformer, StringSource]

CHECKER__PARSE_FULL = logic_integration_check.IntegrationChecker(
    parse_string_transformer.parsers(True).full,
    StringTransformerPropertiesConfiguration(avoid_model_evaluation=False),
    True,
)

CHECKER__PARSE_SIMPLE = logic_integration_check.IntegrationChecker(
    parse_string_transformer.parsers(True).simple,
    StringTransformerPropertiesConfiguration(avoid_model_evaluation=False),
    True,
)

CHECKER__PARSE_SIMPLE__WO_IMPLICIT_MODEL_EVALUATION = logic_integration_check.IntegrationChecker(
    parse_string_transformer.parsers(True).simple,
    StringTransformerPropertiesConfiguration(avoid_model_evaluation=True),
    True,
)