Esempio n. 1
0
def hierarchy(header: str,
              suite_help: TestSuiteHelp) -> SectionHierarchyGenerator:
    tp = TextParser({
        'program_name': formatting.program_name(program_info.PROGRAM_NAME),
        'executable_name': program_info.PROGRAM_NAME,
        'suite_program_mode': SUITE_COMMAND,
        'reporter_concept': formatting.concept_(concepts.SUITE_REPORTER_CONCEPT_INFO),
        'cases': section_names.CASES,
        'suites': section_names.SUITES,
        'ALL_PASS': exit_values.ALL_PASS.exit_identifier,
        'generic_section': SectionName('NAME'),
    })

    def section_of_parsed(contents: str) -> SectionContentsConstructor:
        return sections.constant_contents(
            docs.section_contents(tp.fnap(contents))
        )

    return h.hierarchy(
        header,
        children=[
            h.child('introduction',
                    h.leaf('Introduction',
                           section_of_parsed(_INTRODUCTION))
                    ),
            h.child('structure',
                    structure.root('Structure', suite_help)
                    ),
            h.child('file-syntax',
                    h.leaf('File syntax',
                           section_of_parsed(_FILE_SYNTAX))
                    ),
            h.child('outcome',
                    outcome.root('Outcome')),
        ])
Esempio n. 2
0
def hierarchy(header: str,
              suite_help: TestSuiteHelp) -> SectionHierarchyGenerator:
    tp = TextParser({
        'program_name':
        formatting.program_name(program_info.PROGRAM_NAME),
        'executable_name':
        program_info.PROGRAM_NAME,
        'suite_program_mode':
        SUITE_COMMAND,
        'reporter_concept':
        formatting.concept_(concepts.SUITE_REPORTER_CONCEPT_INFO),
        'cases':
        section_names.CASES,
        'suites':
        section_names.SUITES,
        'ALL_PASS':
        exit_values.ALL_PASS.exit_identifier,
        'generic_section':
        SectionName('NAME'),
    })

    def section_of_parsed(contents: str) -> SectionContentsConstructor:
        return sections.constant_contents(
            docs.section_contents(tp.fnap(contents)))

    return h.hierarchy(
        header,
        children=[
            h.child('introduction',
                    h.leaf('Introduction', section_of_parsed(_INTRODUCTION))),
            h.child('structure', structure.root('Structure', suite_help)),
            h.child('file-syntax',
                    h.leaf('File syntax', section_of_parsed(_FILE_SYNTAX))),
            h.child('outcome', outcome.root('Outcome')),
        ])
Esempio n. 3
0
    def test_hierarchy_with_sub_sections(self):
        # ARRANGE #

        target_factory = TargetInfoFactoryTestImpl(['target_component'])
        expected_section_contents_object1 = doc.empty_section_contents()
        expected_section_contents_object2 = docs.section_contents(docs.paras('testing testing'))
        expected_root_initial_para = docs.para('root initial paras')
        expected_root_initial_paras = [expected_root_initial_para]

        root_header = StringText('root header')

        sub_section_header_1 = 'sub1'
        sub_section_header_2 = 'sub2'
        sub_section_local_target_1 = 'sub-target1'
        sub_section_local_target_2 = 'sub-target2'

        object_to_test = sut.hierarchy(
            root_header,
            paragraphs.constant(expected_root_initial_paras),
            [sut.child(sub_section_local_target_1,
                       sut.leaf(sub_section_header_1,
                                section_contents(expected_section_contents_object1))),
             sut.child(sub_section_local_target_2,
                       sut.leaf(sub_section_header_2,
                                section_contents(expected_section_contents_object2)))
             ])
        # EXPECTATION #
        expected_root_target_info = target_factory.root(root_header)

        sub1_target = target_factory.sub(sub_section_header_1, sub_section_local_target_1)
        sub2_target = target_factory.sub(sub_section_header_2, sub_section_local_target_2)
        target_info_node_assertion = equals_target_info_node(
            TargetInfoNode(expected_root_target_info,
                           [
                               target_info_leaf(sub1_target),
                               target_info_leaf(sub2_target),
                           ]),
            mk_equals_cross_ref_id=equals_custom_cross_ref_test_impl)

        section_assertion2 = section_matches(
            target=equals_custom_cross_ref_test_impl(expected_root_target_info.target),
            header=asrt_para.equals_text(expected_root_target_info.presentation_text),
            contents=section_contents_matches(
                initial_paragraphs=asrt.matches_sequence([asrt.Is(expected_root_initial_para)]),
                sections=asrt.matches_sequence([
                    section_matches(
                        target=equals_custom_cross_ref_test_impl(sub1_target.target),
                        header=asrt_para.equals_text(sub1_target.presentation_text),
                        contents=asrt.Is(expected_section_contents_object1)),
                    section_matches(
                        target=equals_custom_cross_ref_test_impl(sub2_target.target),
                        header=asrt_para.equals_text(sub2_target.presentation_text),
                        contents=asrt.Is(expected_section_contents_object2)),
                ])))
        # ACT & ASSERT #
        self._act_and_assert(object_to_test,
                             target_factory,
                             target_info_node_assertion,
                             section_assertion2)
Esempio n. 4
0
    def test_hierarchy_with_sub_sections(self):
        # ARRANGE #

        target_factory = TargetInfoFactoryTestImpl(['target_component'])
        expected_section_contents_object1 = doc.empty_section_contents()
        expected_section_contents_object2 = docs.section_contents(docs.paras('testing testing'))
        expected_root_initial_para = docs.para('root initial paras')
        expected_root_initial_paras = [expected_root_initial_para]

        root_header = StringText('root header')

        sub_section_header_1 = 'sub1'
        sub_section_header_2 = 'sub2'
        sub_section_local_target_1 = 'sub-target1'
        sub_section_local_target_2 = 'sub-target2'

        object_to_test = sut.hierarchy(
            root_header,
            paragraphs.constant(expected_root_initial_paras),
            [sut.child(sub_section_local_target_1,
                       sut.leaf(sub_section_header_1,
                                section_contents(expected_section_contents_object1))),
             sut.child(sub_section_local_target_2,
                       sut.leaf(sub_section_header_2,
                                section_contents(expected_section_contents_object2)))
             ])
        # EXPECTATION #
        expected_root_target_info = target_factory.root(root_header)

        sub1_target = target_factory.sub(sub_section_header_1, sub_section_local_target_1)
        sub2_target = target_factory.sub(sub_section_header_2, sub_section_local_target_2)
        target_info_node_assertion = equals_target_info_node(
            TargetInfoNode(expected_root_target_info,
                           [
                               target_info_leaf(sub1_target),
                               target_info_leaf(sub2_target),
                           ]),
            mk_equals_cross_ref_id=equals_custom_cross_ref_test_impl)

        section_assertion2 = section_matches(
            target=equals_custom_cross_ref_test_impl(expected_root_target_info.target),
            header=asrt_para.equals_text(expected_root_target_info.presentation_text),
            contents=section_contents_matches(
                initial_paragraphs=asrt.matches_sequence([asrt.Is(expected_root_initial_para)]),
                sections=asrt.matches_sequence([
                    section_matches(
                        target=equals_custom_cross_ref_test_impl(sub1_target.target),
                        header=asrt_para.equals_text(sub1_target.presentation_text),
                        contents=asrt.Is(expected_section_contents_object1)),
                    section_matches(
                        target=equals_custom_cross_ref_test_impl(sub2_target.target),
                        header=asrt_para.equals_text(sub2_target.presentation_text),
                        contents=asrt.Is(expected_section_contents_object2)),
                ])))
        # ACT & ASSERT #
        self._act_and_assert(object_to_test,
                             target_factory,
                             target_info_node_assertion,
                             section_assertion2)
Esempio n. 5
0
def root(header: str) -> SectionHierarchyGenerator:
    return h.with_fixed_root_target(
        PredefinedHelpContentsPartReference(HelpPredefinedContentsPart.TEST_SUITE_CLI),
        h.leaf(
            header,
            ProgramDocumentationSectionContentsConstructor(TestSuiteCliSyntaxDocumentation()))
    )
Esempio n. 6
0
 def _cases_and_sub_suites(self, header: str) -> SectionHierarchyGenerator:
     return h.leaf(
         header,
         sections.constant_contents(
             docs.section_contents(self._cases_and_sub_suites_paragraphs())
         )
     )
Esempio n. 7
0
 def const_paragraphs_child(local_target_name: str,
                            header_: str,
                            paragraphs_: List[ParagraphItem]) -> generator.SectionHierarchyGenerator:
     return h.child(local_target_name,
                    h.leaf(header_,
                           sections.constant_contents(section_contents(paragraphs_)))
                    )
Esempio n. 8
0
 def const_paragraphs_child(local_target_name: str,
                            header_: str,
                            paragraphs_: List[ParagraphItem]) -> generator.SectionHierarchyGenerator:
     return h.child(local_target_name,
                    h.leaf(header_,
                           sections.constant_contents(section_contents(paragraphs_)))
                    )
Esempio n. 9
0
    def test_with_fixed_root_target(self):
        # ARRANGE #

        root_header = StringText('root header')
        sub_header = StringText('sub header')
        sub_local_target_name = 'should not be used'

        fixed_target = CustomCrossReferenceTargetTestImpl('the fixed root target')

        default_target = CustomCrossReferenceTargetTestImpl('default target component')

        target_factory = ConstantTargetInfoFactoryTestImpl(default_target)

        unadjusted_object = sut.hierarchy(root_header,
                                          paragraphs.empty(),
                                          [sut.child(sub_local_target_name,
                                                     sut.leaf(sub_header.value,
                                                              section_contents(doc.empty_section_contents())))
                                           ]
                                          )
        adjusted_object = sut.with_fixed_root_target(fixed_target,
                                                     unadjusted_object)

        # EXPECTATION #

        expected_root_target_info = TargetInfo(root_header,
                                               fixed_target)

        expected_sub_target_info = TargetInfo(sub_header,
                                              default_target)

        target_info_node_assertion = equals_target_info_node(
            TargetInfoNode(expected_root_target_info,
                           [target_info_leaf(expected_sub_target_info)]),
            mk_equals_cross_ref_id=equals_custom_cross_ref_test_impl)

        section_assertion = section_matches(
            target=equals_custom_cross_ref_test_impl(fixed_target),
            header=asrt_para.equals_text(expected_root_target_info.presentation_text),
            contents=section_contents_matches(
                initial_paragraphs=asrt.is_empty_sequence,
                sections=asrt.matches_sequence([
                    section_matches(
                        target=equals_custom_cross_ref_test_impl(default_target),
                        header=asrt_para.equals_text(sub_header),
                        contents=section_contents_matches(
                            initial_paragraphs=asrt.is_empty_sequence,
                            sections=asrt.is_empty_sequence
                        )
                    )
                ])
            ))

        # ACT & ASSERT #

        self._act_and_assert(adjusted_object,
                             target_factory,
                             target_info_node_assertion,
                             section_assertion)
Esempio n. 10
0
    def test_with_fixed_root_target(self):
        # ARRANGE #

        root_header = StringText('root header')
        sub_header = StringText('sub header')
        sub_local_target_name = 'should not be used'

        fixed_target = CustomCrossReferenceTargetTestImpl('the fixed root target')

        default_target = CustomCrossReferenceTargetTestImpl('default target component')

        target_factory = ConstantTargetInfoFactoryTestImpl(default_target)

        unadjusted_object = sut.hierarchy(root_header,
                                          paragraphs.empty(),
                                          [sut.child(sub_local_target_name,
                                                     sut.leaf(sub_header.value,
                                                              section_contents(doc.empty_section_contents())))
                                           ]
                                          )
        adjusted_object = sut.with_fixed_root_target(fixed_target,
                                                     unadjusted_object)

        # EXPECTATION #

        expected_root_target_info = TargetInfo(root_header,
                                               fixed_target)

        expected_sub_target_info = TargetInfo(sub_header,
                                              default_target)

        target_info_node_assertion = equals_target_info_node(
            TargetInfoNode(expected_root_target_info,
                           [target_info_leaf(expected_sub_target_info)]),
            mk_equals_cross_ref_id=equals_custom_cross_ref_test_impl)

        section_assertion = section_matches(
            target=equals_custom_cross_ref_test_impl(fixed_target),
            header=asrt_para.equals_text(expected_root_target_info.presentation_text),
            contents=section_contents_matches(
                initial_paragraphs=asrt.is_empty_sequence,
                sections=asrt.matches_sequence([
                    section_matches(
                        target=equals_custom_cross_ref_test_impl(default_target),
                        header=asrt_para.equals_text(sub_header),
                        contents=section_contents_matches(
                            initial_paragraphs=asrt.is_empty_sequence,
                            sections=asrt.is_empty_sequence
                        )
                    )
                ])
            ))

        # ACT & ASSERT #

        self._act_and_assert(adjusted_object,
                             target_factory,
                             target_info_node_assertion,
                             section_assertion)
Esempio n. 11
0
def root(header: str) -> SectionHierarchyGenerator:
    return h.with_fixed_root_target(
        PredefinedHelpContentsPartReference(
            HelpPredefinedContentsPart.SYMBOL_CLI),
        h.leaf(
            header,
            ProgramDocumentationSectionContentsConstructor(
                SymbolCliSyntaxDocumentation())))
Esempio n. 12
0
def root(header: str,
         test_case_help: TestCaseHelp) -> SectionHierarchyGenerator:
    return h.hierarchy(header,
                       children=[
                           h.child(
                               'introduction',
                               h.leaf('Introduction', intro.Documentation())),
                           h.child('structure',
                                   structure.root('Structure',
                                                  test_case_help)),
                           h.child('exe-env',
                                   env_doc.root('Execution environment')),
                           h.child('file-syntax',
                                   file_syntax.root('File syntax')),
                           h.child(
                               'processing',
                               h.leaf('Processing steps',
                                      processing.ContentsConstructor())),
                           h.child('outcome', outcome.root('Outcome')),
                       ])
Esempio n. 13
0
def root(header: str) -> generator.SectionHierarchyGenerator:
    preamble_paragraphs = TEXT_PARSER.fnap(PREAMBLE)

    def const_contents(
        header_: str, paragraphs_: List[ParagraphItem]
    ) -> generator.SectionHierarchyGenerator:
        return h.leaf(
            header_, sections.constant_contents(section_contents(paragraphs_)))

    return h.hierarchy(header, paragraphs.constant(preamble_paragraphs), [
        h.child('reporting',
                h.leaf('Reporting', _ReportingContentsConstructor())),
        h.child('scenarios', const_contents('Scenarios', _scenarios_list())),
    ])
Esempio n. 14
0
 def generator(self, header: str) -> SectionHierarchyGenerator:
     return h.hierarchy(header, paragraphs.constant(
         self._tp.fnap(_PRELUDE)
     ), [
         h.child('cases-and-sub-suites',
                 self._cases_and_sub_suites(CASES_AND_SUB_SUITES_HEADER)),
         h.child('common-test-case-contents',
                 self._common_tc_contents(COMMON_CASE_CONTENTS_HEADER)),
         h.child(
             'additional-test-case-conf',
             h.leaf(
                 ADDITIONAL_TEST_CASE_CONFIG_HEADER,
                 sections.constant_contents(
                     docs.section_contents(
                         self._tp.fnap(_ADDITIONAL_TEST_CASE_CONFIG))))),
     ])
Esempio n. 15
0
 def generator(self, header: str) -> SectionHierarchyGenerator:
     return h.hierarchy(
         header,
         paragraphs.constant(self._tp.fnap(_PRELUDE)),
         [
             h.child('cases-and-sub-suites',
                     self._cases_and_sub_suites(CASES_AND_SUB_SUITES_HEADER)
                     ),
             h.child('common-test-case-contents',
                     self._common_tc_contents(COMMON_CASE_CONTENTS_HEADER)
                     ),
             h.child('additional-test-case-conf',
                     h.leaf(
                         ADDITIONAL_TEST_CASE_CONFIG_HEADER,
                         sections.constant_contents(
                             docs.section_contents(self._tp.fnap(_ADDITIONAL_TEST_CASE_CONFIG))
                         ))
                     ),
         ])
Esempio n. 16
0
def root(header: str) -> generator.SectionHierarchyGenerator:
    preamble_paragraphs = TEXT_PARSER.fnap(PREAMBLE)

    def const_contents(header_: str, paragraphs_: List[ParagraphItem]) -> generator.SectionHierarchyGenerator:
        return h.leaf(header_,
                      sections.constant_contents(section_contents(paragraphs_)))

    return h.hierarchy(
        header,
        paragraphs.constant(preamble_paragraphs),
        [
            h.child('reporting',
                    h.leaf('Reporting',
                           _ReportingContentsConstructor())
                    ),
            h.child('scenarios',
                    const_contents('Scenarios',
                                   _scenarios_list())
                    ),
        ]
    )
Esempio n. 17
0
    def test_leaf(self):
        # ARRANGE #
        target_factory = TargetInfoFactoryTestImpl(['target_component'])
        expected_section_contents_object = doc.empty_section_contents()
        object_to_test = sut.leaf('header', section_contents(expected_section_contents_object))
        # EXPECTATION #
        expected_target_info = target_factory.root(StringText('header'))

        target_info_node_assertion = equals_target_info_node(
            target_info_leaf(expected_target_info),
            mk_equals_cross_ref_id=equals_custom_cross_ref_test_impl)

        section_assertion = section_matches(
            target=equals_custom_cross_ref_test_impl(expected_target_info.target),
            header=asrt_para.equals_text(expected_target_info.presentation_text),
            contents=asrt.Is(expected_section_contents_object))

        # ACT & ASSERT #
        self._act_and_assert(object_to_test,
                             target_factory,
                             target_info_node_assertion,
                             section_assertion)
Esempio n. 18
0
    def test_leaf(self):
        # ARRANGE #
        target_factory = TargetInfoFactoryTestImpl(['target_component'])
        expected_section_contents_object = doc.empty_section_contents()
        object_to_test = sut.leaf('header', section_contents(expected_section_contents_object))
        # EXPECTATION #
        expected_target_info = target_factory.root(StringText('header'))

        target_info_node_assertion = equals_target_info_node(
            target_info_leaf(expected_target_info),
            mk_equals_cross_ref_id=equals_custom_cross_ref_test_impl)

        section_assertion = section_matches(
            target=equals_custom_cross_ref_test_impl(expected_target_info.target),
            header=asrt_para.equals_text(expected_target_info.presentation_text),
            contents=asrt.Is(expected_section_contents_object))

        # ACT & ASSERT #
        self._act_and_assert(object_to_test,
                             target_factory,
                             target_info_node_assertion,
                             section_assertion)
Esempio n. 19
0
    def test_with_hidden_from_toc(self):
        # ARRANGE #
        target_factory = TargetInfoFactoryTestImpl(['target_component'])
        expected_section_contents_object = doc.empty_section_contents()
        header = StringText('header')
        unadjusted_object = sut.leaf(header.value,
                                     section_contents(expected_section_contents_object))
        adjusted_object = sut.with_not_in_toc(unadjusted_object)
        # EXPECTATION #
        expected_target_info = target_factory.root(header)

        target_info_node_assertion = asrt.is_none

        section_assertion = section_matches(
            target=equals_custom_cross_ref_test_impl(expected_target_info.target),
            header=asrt_para.equals_text(header),
            contents=asrt.Is(expected_section_contents_object))

        # ACT & ASSERT #
        self._act_and_assert(adjusted_object,
                             target_factory,
                             target_info_node_assertion,
                             section_assertion)
Esempio n. 20
0
def root(header: str, setup: Setup) -> generator.SectionHierarchyGenerator:
    tp = TextParser({
        'default_suite_file_name': file_names.DEFAULT_SUITE_FILE,
        'act': phase_infos.ACT.name,
        'action_to_check': concepts.ACTION_TO_CHECK_CONCEPT_INFO.name,
        'ATC': concepts.ACTION_TO_CHECK_CONCEPT_INFO.acronym,
        'actor': concepts.ACTOR_CONCEPT_INFO.name,
        'os_process': misc_texts.OS_PROCESS_NAME,
        'null_actor': actors.NULL_ACTOR.singular_name,
        'shell_command_marker': SHELL_COMMAND_MARKER,
    })

    def const_paragraphs(header_: StrOrStringText,
                         initial_paragraphs: List[docs.ParagraphItem]) -> generator.SectionHierarchyGenerator:
        return h.leaf(header_,
                      sections.constant_contents(docs.section_contents(initial_paragraphs)))

    def phases_documentation() -> List[ParagraphItem]:
        return (tp.fnap(_PHASES_INTRO) +
                [sections_short_list(setup.test_case_help.phase_helps_in_order_of_execution,
                                     phase_identifier.DEFAULT_PHASE.section_name,
                                     phase_names_plain.SECTION_CONCEPT_NAME)])

    act_contents = sections.contents(
        paragraphs.constant(tp.fnap(_ACT)),
        [
            _act_examples(tp),
            see_also.SeeAlsoSectionConstructor(
                see_also.items_of_targets(_act_see_also_targets())
            )
        ]
    )

    instructions_contents = sections.contents(
        paragraphs.constant(tp.fnap(_INSTRUCTIONS)),
        [
            see_also.SeeAlsoSectionConstructor(
                see_also.items_of_targets(_instructions_see_also_targets())
            )
        ]
    )

    return h.hierarchy(
        header,
        children=[
            h.child('phases',
                    const_paragraphs('Phases',
                                     phases_documentation())
                    ),
            h.child('act',
                    h.leaf(
                        tp.text('The {act} phase, {action_to_check:/q} and {actor:s/q}'),
                        act_contents
                    )
                    ),
            h.child('instructions',
                    h.leaf('Instructions',
                           instructions_contents)
                    ),
            h.child('suites',
                    h.hierarchy(
                        'Relation to test suites',
                        children=[
                            h.child('suite-contents',
                                    const_paragraphs('Inclusion of phase contents from suites',
                                                     tp.fnap(_SUITE_CONTENTS_INCLUSION))
                                    ),
                            h.child('part-of-suite',
                                    const_paragraphs('Part of suite',
                                                     tp.fnap(_PART_OF_SUITE))
                                    ),
                            h.with_not_in_toc(
                                h.leaf(
                                    see_also.SEE_ALSO_TITLE,
                                    see_also.SeeAlsoSectionContentsConstructor(
                                        see_also.items_of_targets(_suite_see_also_targets())
                                    )))
                            ,
                        ]),
                    ),
        ]
    )
Esempio n. 21
0
def root(header: str) -> generator.SectionHierarchyGenerator:
    tp = TextParser({

        'program_name': formatting.program_name(program_info.PROGRAM_NAME),
        'conf_param': formatting.concept_(concepts.CONFIGURATION_PARAMETER_CONCEPT_INFO),

        'tcds_concept': formatting.concept_(concepts.TEST_CASE_DIRECTORY_STRUCTURE_CONCEPT_INFO),
        'TCDS': concepts.TEST_CASE_DIRECTORY_STRUCTURE_CONCEPT_INFO.acronym,

        'SDS': concepts.SANDBOX_CONCEPT_INFO.acronym,
        'sds_concept': formatting.concept_(concepts.SANDBOX_CONCEPT_INFO),
        'Sds_concept_header': concepts.SANDBOX_CONCEPT_INFO.singular_name.capitalize(),
        'sds_single_line_description':
            concepts.SANDBOX_CONCEPT_INFO.single_line_description_str.capitalize(),

        'HDS': concepts.HOME_DIRECTORY_STRUCTURE_CONCEPT_INFO.acronym,
        'hds_concept': formatting.concept_(concepts.HOME_DIRECTORY_STRUCTURE_CONCEPT_INFO),
        'Hds_concept_header': concepts.HOME_DIRECTORY_STRUCTURE_CONCEPT_INFO.singular_name.capitalize(),
        'hds_single_line_description':
            concepts.HOME_DIRECTORY_STRUCTURE_CONCEPT_INFO.single_line_description_str.capitalize(),

        'conf_phase': phase_names.CONFIGURATION,
        'act_phase': phase_names.ACT,

        'act_home_conf_param': formatting.conf_param(test_case_file_structure.HDS_ACT_INFO.identifier),

        'data': type_system.DATA_TYPE_CATEGORY_NAME,
        'path_type': formatting.term(types.PATH_TYPE_INFO.singular_name),

        'symbol_concept': formatting.concept_(concepts.SYMBOL_CONCEPT_INFO),
        'def_instruction': InstructionName(instruction_names.SYMBOL_DEFINITION_INSTRUCTION_NAME),

        'os_process': misc_texts.OS_PROCESS_NAME,
        'time_out_conf_param': formatting.conf_param_(conf_params.TIMEOUT_CONF_PARAM_INFO),

        'relativity': formatting.concept(misc_texts.RELATIVITY.singular),
        'relativities': formatting.concept(misc_texts.RELATIVITY.plural),

        'cd': formatting.emphasis(instruction_names.CHANGE_DIR_INSTRUCTION_NAME),
        'env': formatting.emphasis(instruction_names.ENV_VAR_INSTRUCTION_NAME),
        'CD': formatting.concept_(concepts.CURRENT_WORKING_DIRECTORY_CONCEPT_INFO),
    })

    def const_paragraphs_child(local_target_name: str,
                               header_: str,
                               paragraphs_: List[ParagraphItem]) -> generator.SectionHierarchyGenerator:
        return h.child(local_target_name,
                       h.leaf(header_,
                              sections.constant_contents(section_contents(paragraphs_)))
                       )

    return h.hierarchy(
        header,
        children=[
            h.child_hierarchy(
                'dir-structure',
                'Directory structure and Current directory',
                paragraphs.constant(tp.fnap(_DS_CD_PREAMBLE)),
                [
                    const_paragraphs_child(
                        'sds',
                        concepts.SANDBOX_CONCEPT_INFO.singular_name.capitalize() +
                        ' and Current directory',
                        tp.fnap(_SDS_AND_CD)
                    ),
                    const_paragraphs_child(
                        'hds',
                        concepts.HOME_DIRECTORY_STRUCTURE_CONCEPT_INFO.singular_name.capitalize(),
                        tp.fnap(_HDS),
                    ),
                    const_paragraphs_child(
                        'file-ref',
                        'File references',
                        tp.fnap(_FILE_REFERENCES)
                    ),
                    h.child('see-also',
                            h.with_not_in_toc(
                                h.leaf(
                                    see_also.SEE_ALSO_TITLE,
                                    see_also.SeeAlsoSectionContentsConstructor(
                                        see_also.items_of_targets(_dir_struct_see_also_targets())
                                    )))
                            ),
                ]
            ),
            h.child_hierarchy(
                'symbols',
                concepts.SYMBOL_CONCEPT_INFO.plural_name.capitalize(),
                paragraphs.constant(tp.fnap(_SYMBOLS)),
                [
                    h.with_not_in_toc(
                        h.child_leaf(
                            'see-also',
                            see_also.SEE_ALSO_TITLE,
                            see_also.SeeAlsoSectionContentsConstructor(
                                see_also.items_of_targets(_symbols_see_also_targets())
                            ))
                    )
                ]
            ),
            h.child_hierarchy(
                'os-proc',
                tp.text('{os_process} environment'),
                paragraphs.constant(tp.fnap(_OS_PROC_INTRO)),
                [
                    const_paragraphs_child(
                        'cd',
                        'Current directory',
                        tp.fnap(_OS_PROC_CURRENT_DIRECTORY),
                    ),
                    const_paragraphs_child(
                        'env-vars',
                        'Environment variables',
                        tp.fnap(_OS_PROC_ENVIRONMENT_VARIABLES),
                    ),
                    const_paragraphs_child(
                        'timeout',
                        'Timeout',
                        tp.fnap(_OS_PROC_TIMEOUT),
                    ),
                    h.with_not_in_toc(
                        h.child_leaf(
                            'see-also',
                            see_also.SEE_ALSO_TITLE,
                            see_also.SeeAlsoSectionContentsConstructor(
                                see_also.items_of_targets(_os_process_see_also_targets())
                            )))
                    ,
                ],
            ),
        ]
    )
Esempio n. 22
0
 def const_paragraphs(header_: StrOrStringText,
                      initial_paragraphs: List[docs.ParagraphItem]) -> generator.SectionHierarchyGenerator:
     return h.leaf(header_,
                   sections.constant_contents(docs.section_contents(initial_paragraphs)))
Esempio n. 23
0
def root(header: str, test_case_help: TestCaseHelp) -> generator.SectionHierarchyGenerator:
    tp = TextParser({
        'default_suite_file_name': file_names.DEFAULT_SUITE_FILE,
        'act': phase_infos.ACT.name,
        'assert': phase_infos.ASSERT.name,
        'setup': phase_infos.SETUP.name,
        'action_to_check': concepts.ACTION_TO_CHECK_CONCEPT_INFO.name,
        'instruction': concepts.INSTRUCTION_CONCEPT_INFO.name,
        'ATC': concepts.ACTION_TO_CHECK_CONCEPT_INFO.acronym,
        'actor': concepts.ACTOR_CONCEPT_INFO.name,
        'os_process': misc_texts.OS_PROCESS_NAME,
        'null_actor': actors.NULL_ACTOR.singular_name,
        'shell_command_marker': SHELL_COMMAND_MARKER,
        'shell_command': formatting.misc_name_with_formatting(misc_texts.SHELL_COMMAND),
        'shell_command_line': formatting.misc_name_with_formatting(misc_texts.SHELL_COMMAND_LINE),
    })

    def const_paragraphs(header_: StrOrStringText,
                         initial_paragraphs: List[docs.ParagraphItem]) -> generator.SectionHierarchyGenerator:
        return h.leaf(header_,
                      sections.constant_contents(docs.section_contents(initial_paragraphs)))

    def phases_documentation() -> List[ParagraphItem]:
        return (tp.fnap(_PHASES_INTRO) +
                [sections_short_list(test_case_help.phase_helps_in_order_of_execution,
                                     phase_identifier.DEFAULT_PHASE.section_name,
                                     phase_names_plain.SECTION_CONCEPT_NAME)])

    act_contents = sections.contents(
        paragraphs.constant(tp.fnap(_ACT)),
        [
            _act_examples(tp),
            see_also.SeeAlsoSectionConstructor(
                see_also.items_of_targets(_act_see_also_targets())
            )
        ]
    )

    instructions_contents = sections.contents(
        paragraphs.constant(tp.fnap(_INSTRUCTIONS)),
        [
            see_also.SeeAlsoSectionConstructor(
                see_also.items_of_targets(_instructions_see_also_targets())
            )
        ]
    )

    return h.hierarchy(
        header,
        children=[
            h.child('phases',
                    const_paragraphs('Phases',
                                     phases_documentation())
                    ),
            h.child('act',
                    h.leaf(
                        tp.text('The {act} phase, {action_to_check:/q} and {actor:s/q}'),
                        act_contents
                    )
                    ),
            h.child('instructions',
                    h.leaf(tp.text('{instruction:s/u}'),
                           instructions_contents)
                    ),
            h.child('suites',
                    h.hierarchy(
                        'Relation to test suites',
                        children=[
                            h.child('suite-contents',
                                    const_paragraphs('Inclusion of phase contents from suites',
                                                     tp.fnap(_SUITE_CONTENTS_INCLUSION))
                                    ),
                            h.child('part-of-suite',
                                    const_paragraphs('Part of suite',
                                                     tp.fnap(_PART_OF_SUITE))
                                    ),
                            h.leaf_not_in_toc(
                                see_also.SEE_ALSO_TITLE,
                                see_also.SeeAlsoSectionContentsConstructor(
                                    see_also.items_of_targets(_suite_see_also_targets())
                                )
                            ),
                        ]),
                    ),
        ]
    )
Esempio n. 24
0
 def const_contents(header_: str, paragraphs: List[ParagraphItem]) -> generator.SectionHierarchyGenerator:
     return h.leaf(header_,
                   sections.constant_contents(section_contents(paragraphs)))
Esempio n. 25
0
def root(header: str) -> h.SectionHierarchyGenerator:
    return h.leaf(header,
                  ProgramDocumentationSectionContentsConstructor(HelpCliSyntaxDocumentation()))
Esempio n. 26
0
 def _cases_and_sub_suites(self, header: str) -> SectionHierarchyGenerator:
     return h.leaf(
         header,
         sections.constant_contents(
             docs.section_contents(
                 self._cases_and_sub_suites_paragraphs())))
Esempio n. 27
0
 def const_contents(
     header_: str, paragraphs_: List[ParagraphItem]
 ) -> generator.SectionHierarchyGenerator:
     return h.leaf(
         header_, sections.constant_contents(section_contents(paragraphs_)))
Esempio n. 28
0
def root(header: str) -> h.SectionHierarchyGenerator:
    return h.leaf(
        header,
        ProgramDocumentationSectionContentsConstructor(
            HelpCliSyntaxDocumentation()))
Esempio n. 29
0
 def _common_tc_contents(self, header: str) -> SectionHierarchyGenerator:
     return h.leaf(
         header,
         sections.constant_contents(
             docs.section_contents(self._common_tc_contents_paragraphs())
         ))
Esempio n. 30
0
 def const_paragraphs(header_: StrOrStringText,
                      initial_paragraphs: List[docs.ParagraphItem]) -> generator.SectionHierarchyGenerator:
     return h.leaf(header_,
                   sections.constant_contents(docs.section_contents(initial_paragraphs)))
Esempio n. 31
0
 def _common_tc_contents(self, header: str) -> SectionHierarchyGenerator:
     return h.leaf(
         header,
         sections.constant_contents(
             docs.section_contents(self._common_tc_contents_paragraphs())))