コード例 #1
0
ファイル: prune.py プロジェクト: emilkarlen/exactly
    def runTest(self):
        # ARRANGE #

        helper = IntegrationCheckHelper()

        arguments = fsm_args.Prune(
            fm_args.SymbolReference(NAME_STARTS_WITH__P1.name),
            helper.files_matcher_sym_ref_arg(),
        ).as_arguments

        # ACT & ASSERT #

        for depth, nie in COMBINATION_OF_PRUNE_AND_DEPTH_LIMITATIONS:
            with self.subTest(data=nie.name, depth=depth):
                integration_check.CHECKER__PARSE_FULL.check__w_source_variants(
                    self,
                    arguments=arguments,
                    input_=helper.model_constructor_for_checked_dir__recursive(
                        min_depth=depth, max_depth=depth),
                    arrangement=helper.arrangement_for_contents_of_model(
                        checked_dir_contents=nie.actual,
                        files_matcher_symbol_value=model_checker.matcher(
                            self,
                            helper.dir_arg.path_sdv,
                            nie.expected,
                        ),
                        additional_symbols=[NAME_STARTS_WITH__P1],
                    ),
                    expectation=Expectation(
                        ParseExpectation(
                            symbol_references=asrt.matches_sequence([
                                NAME_STARTS_WITH__P1.reference_assertion,
                                helper.symbol_reference_assertion,
                            ]), )),
                )
コード例 #2
0
ファイル: prune.py プロジェクト: emilkarlen/exactly
    def runTest(self):
        # ARRANGE #

        helper = IntegrationCheckHelper()

        # ACT & ASSERT #

        integration_check.CHECKER__PARSE_FULL.check(
            self,
            source=fsm_args.Prune(
                matcher_argument.Constant(False),
                helper.files_matcher_sym_ref_arg(),
            ).as_remaining_source,
            input_=helper.model_constructor_for_checked_dir__recursive(),
            arrangement=helper.arrangement_for_contents_of_model(
                checked_dir_contents=
                BROKEN_SYM_LINKS_SHOULD_BE_TREATED_AS_NON_DIR_FILES.actual,
                files_matcher_symbol_value=model_checker.matcher(
                    self,
                    helper.dir_arg.path_sdv,
                    BROKEN_SYM_LINKS_SHOULD_BE_TREATED_AS_NON_DIR_FILES.
                    expected,
                ),
            ),
            expectation=Expectation(
                ParseExpectation(
                    symbol_references=helper.symbol_references_expectation(),
                ),
                EXECUTION_IS_PASS,
            ),
        )
コード例 #3
0
ファイル: prune.py プロジェクト: emilkarlen/exactly
    def runTest(self):
        # ARRANGE #

        helper = IntegrationCheckHelper()

        # ACT & ASSERT #

        integration_check.CHECKER__PARSE_FULL.check(
            self,
            source=fsm_args.Prune(
                fm_args.Type(FileType.SYMLINK),
                helper.files_matcher_sym_ref_arg(),
            ).as_remaining_source,
            input_=helper.model_constructor_for_checked_dir__recursive(),
            arrangement=helper.arrangement_for_contents_of_model(
                checked_dir_contents=PRUNE_TYPE_SYM_LINK.actual,
                files_matcher_symbol_value=model_checker.matcher(
                    self,
                    helper.dir_arg.path_sdv,
                    PRUNE_TYPE_SYM_LINK.expected,
                ),
            ),
            expectation=Expectation(
                ParseExpectation(
                    symbol_references=helper.symbol_references_expectation(),
                ),
                EXECUTION_IS_PASS,
            ),
        )
コード例 #4
0
 def symbols(self, put: unittest.TestCase) -> SymbolTable:
     return SymbolContext.symbol_table_of_contexts([
         FilesMatcherSymbolContext.of_sdv(
             self.files_matcher_name,
             model_checker.matcher(
                 put,
                 self.model_file.path,
                 test_data.strip_file_type_info(
                     self.expected_and_actual.expected),
             )),
         StringIntConstantSymbolContext(
             self.min_depth.name,
             self.min_depth.value,
         ),
         StringIntConstantSymbolContext(
             self.max_depth.name,
             self.max_depth.value,
         ),
     ])
コード例 #5
0
ファイル: prune.py プロジェクト: emilkarlen/exactly
    def runTest(self):
        # ARRANGE #
        helper = IntegrationCheckHelper()

        test_fails_if_applied__matcher_symbol_context = test_fails_if_applied(
            self)

        arguments = fsm_args.Prune(
            fm_args.SymbolReference(
                test_fails_if_applied__matcher_symbol_context.name),
            helper.files_matcher_sym_ref_arg(),
        )

        # ACT & ASSERT #

        integration_check.CHECKER__PARSE_FULL.check(
            self,
            source=arguments.as_remaining_source,
            input_=helper.model_constructor_for_checked_dir__non_recursive(),
            arrangement=helper.arrangement_for_contents_of_model(
                checked_dir_contents=NON_RECURSIVE__ACTUAL,
                files_matcher_symbol_value=model_checker.matcher(
                    self,
                    helper.dir_arg.path_sdv,
                    test_data.strip_file_type_info(
                        test_data.expected_is_actual_down_to_max_depth(
                            0, NON_RECURSIVE__ACTUAL).expected),
                ),
                additional_symbols=[
                    test_fails_if_applied__matcher_symbol_context
                ],
            ),
            expectation=Expectation(
                ParseExpectation(symbol_references=asrt.matches_sequence([
                    test_fails_if_applied__matcher_symbol_context.
                    reference_assertion,
                    helper.symbol_reference_assertion,
                ])),
                EXECUTION_IS_PASS,
            ))
コード例 #6
0
ファイル: prune.py プロジェクト: emilkarlen/exactly
    def runTest(self):
        # ARRANGE #

        helper = IntegrationCheckHelper()

        argument_cases = [
            NIE(
                'prune followed by selection',
                input_value=fsm_args.Prune(
                    fm_args.SymbolReference(NAME_STARTS_WITH__P1.name),
                    fsm_args.Selection(
                        fm_args.SymbolReference(NAME_STARTS_WITH__S1.name),
                        helper.files_matcher_sym_ref_arg(),
                    ),
                ),
                expected_value=asrt.matches_sequence([
                    NAME_STARTS_WITH__P1.reference_assertion,
                    NAME_STARTS_WITH__S1.reference_assertion,
                    helper.symbol_reference_assertion,
                ]),
            ),
            NIE(
                'selection followed by prune',
                input_value=fsm_args.Selection(
                    fm_args.SymbolReference(NAME_STARTS_WITH__S1.name),
                    fsm_args.Prune(
                        fm_args.SymbolReference(NAME_STARTS_WITH__P1.name),
                        helper.files_matcher_sym_ref_arg(),
                    ),
                ),
                expected_value=asrt.matches_sequence([
                    NAME_STARTS_WITH__S1.reference_assertion,
                    NAME_STARTS_WITH__P1.reference_assertion,
                    helper.symbol_reference_assertion,
                ]),
            ),
        ]

        contents_case = COMBINATION_OF_PRUNE_AND_SELECTION

        # ACT & ASSERT #

        for argument_case in argument_cases:
            with self.subTest(argument_case.name):
                integration_check.CHECKER__PARSE_FULL.check__w_source_variants(
                    self,
                    arguments=argument_case.input_value.as_arguments,
                    input_=helper.model_constructor_for_checked_dir__recursive(
                    ),
                    arrangement=helper.arrangement_for_contents_of_model(
                        checked_dir_contents=contents_case.actual,
                        files_matcher_symbol_value=model_checker.matcher(
                            self,
                            helper.dir_arg.path_sdv,
                            contents_case.expected,
                        ),
                        additional_symbols=[
                            NAME_STARTS_WITH__P1,
                            NAME_STARTS_WITH__S1,
                        ],
                    ),
                    expectation=Expectation(
                        ParseExpectation(
                            symbol_references=argument_case.expected_value, )),
                )
コード例 #7
0
        integration_check.CHECKER__PARSE_FULL.check_multi(
            self,
            arguments=fm_args.DirContentsRecursive(
                helper.files_matcher_sym_ref_arg()).as_arguments,
            parse_expectation=helper.parse_expectation_of_symbol_references(),
            input_=helper.model_constructor_for_checked_dir(),
            execution=[
                NExArr(
                    contents_case.name,
                    PrimAndExeExpectation.of_exe(),
                    helper.arrangement_for_contents_of_model(
                        checked_dir_contents=contents_case.actual,
                        files_matcher_symbol_value=model_checker.matcher(
                            self,
                            helper.dir_arg.path_sdv,
                            contents_case.expected,
                        ),
                    ),
                ) for contents_case in contents_cases
            ],
        )


class TestConcreteMatcher(unittest.TestCase):
    def test_wo_selection(self):
        # ARRANGE #
        helper = files_matcher_integration.NumFilesWoSelectionTestCaseHelper(
            files_matcher_integration.MODEL_CONTENTS__RECURSIVE,
            RelSdsOptionType.REL_ACT,
            'checked-dir',