def __init__(self): super().__init__(TypeCategory.DATA, syntax_elements.PATH_SYNTAX_ELEMENT) self._string_name = a.Named(syntax_elements.STRING_SYNTAX_ELEMENT.singular_name) self._relativity_name = instruction_arguments.RELATIVITY_ARGUMENT path_type_symbol = 'MY_PATH_SYMBOL' self._parser = TextParser({ 'RELATIVITY_OPTION': self._relativity_name.name, 'PATH_STRING': self._string_name.name, 'posix_syntax': documentation_text.POSIX_SYNTAX, 'string_type': formatting.keyword(types.STRING_TYPE_INFO.name.singular), 'path_type': formatting.keyword(types.PATH_TYPE_INFO.name.singular), 'string_syntax_element': syntax_elements.STRING_SYNTAX_ELEMENT.singular_name, 'cd': formatting.concept_(concepts.CURRENT_WORKING_DIRECTORY_CONCEPT_INFO), 'symbol': formatting.concept_(concepts.SYMBOL_CONCEPT_INFO), 'SYMBOL_NAME': syntax_elements.SYMBOL_NAME_SYNTAX_ELEMENT.argument.name, 'define_symbol': formatting.InstructionName(instruction_names.SYMBOL_DEFINITION_INSTRUCTION_NAME), 'current_directory': formatting.concept_(concepts.CURRENT_WORKING_DIRECTORY_CONCEPT_INFO), 'REFERENCED_SYMBOL': path_type_symbol, 'SYMBOL_REFERENCE': symbol_reference_syntax_for_name(path_type_symbol), 'def_of_path_symbol': define_symbol.def_syntax_string(ValueType.PATH, path_type_symbol, '...'), 'ref_of_path_symbol': '... ' + str(PurePosixPath(symbol_reference_syntax_for_name(path_type_symbol)) / 'a' / 'path' / 'relative' / 'to' / path_type_symbol), })
def __init__(self): super().__init__(syntax_elements.PATH_SYNTAX_ELEMENT) self._file_name = instruction_arguments.FILE_NAME_STRING self._relativity_name = instruction_arguments.RELATIVITY_ARGUMENT path_type_symbol = 'MY_PATH_SYMBOL' self._parser = TextParser({ 'Note': headers.NOTE_LINE_HEADER, 'RELATIVITY_OPTION': self._relativity_name.name, 'PATH_STRING': self._file_name.name, 'posix_syntax': documentation_text.POSIX_SYNTAX, 'string_type': formatting.keyword(types.STRING_TYPE_INFO.name.singular), 'string_type_plain': types.STRING_TYPE_INFO.name, 'reserved_word': misc_texts.RESERVED_WORD_NAME, 'reserved_word_list_str': ', '.join([formatting.keyword(x) for x in reserved_words.RESERVED_TOKENS]), 'path_type': formatting.keyword(types.PATH_TYPE_INFO.name.singular), 'string_syntax_element': syntax_elements.STRING_SYNTAX_ELEMENT.singular_name, 'cd': formatting.concept_(concepts.CURRENT_WORKING_DIRECTORY_CONCEPT_INFO), 'symbol': formatting.concept_(concepts.SYMBOL_CONCEPT_INFO), 'SYMBOL_NAME': syntax_elements.SYMBOL_NAME_SYNTAX_ELEMENT.argument.name, 'define_symbol': formatting.InstructionName(instruction_names.SYMBOL_DEFINITION_INSTRUCTION_NAME), 'current_directory': formatting.concept_(concepts.CURRENT_WORKING_DIRECTORY_CONCEPT_INFO), 'REFERENCED_SYMBOL': path_type_symbol, 'SYMBOL_REFERENCE': symbol_reference_syntax_for_name(path_type_symbol), 'def_of_path_symbol': define_symbol.def_syntax_string(ValueType.PATH, path_type_symbol, '...'), 'ref_of_path_symbol': '... ' + str(PurePosixPath(symbol_reference_syntax_for_name(path_type_symbol)) / 'a' / 'path' / 'relative' / 'to' / path_type_symbol), })
def __init__(self): super().__init__(concepts.HOME_DIRECTORY_STRUCTURE_CONCEPT_INFO) self._tp = TextParser({ 'HDS': formatting.concept_(concepts.HOME_DIRECTORY_STRUCTURE_CONCEPT_INFO), 'phase': phase_names.PHASE_NAME_DICTIONARY, 'program_name': formatting.program_name(program_info.PROGRAM_NAME), 'symbol': formatting.concept_(concepts.SYMBOL_CONCEPT_INFO), 'symbols': formatting.concept(concepts.SYMBOL_CONCEPT_INFO.plural_name), 'conf_params': formatting.concept(concepts.CONFIGURATION_PARAMETER_CONCEPT_INFO.plural_name), 'PATH': syntax_elements.PATH_SYNTAX_ELEMENT.singular_name, })
def __init__(self): self.executable = a.Named(command_line_actor.EXECUTABLE) self.argument = a.Named(command_line_actor.ARGUMENT) self.command = a.Constant(command_line_actor.COMMAND) fm = { 'EXECUTABLE': self.executable.name, 'ARGUMENT': self.argument.name, 'actor': formatting.concept_(concepts.ACTOR_CONCEPT_INFO), 'act_phase': phase_names.ACT.emphasis, 'shell_syntax_concept': formatting.concept_(concepts.SHELL_SYNTAX_CONCEPT_INFO), 'program_name': formatting.program_name(program_info.PROGRAM_NAME), } super().__init__(TextParser(fm))
def __init__(self, name: str, instruction_set: SectionInstructionSet): super().__init__(name, instruction_set) self._tp = TextParser({ 'phase': phase_names.PHASE_NAME_DICTIONARY, 'PASS': exit_values.EXECUTION__PASS.exit_identifier, 'FAIL': exit_values.EXECUTION__FAIL.exit_identifier, 'HARD_ERROR': exit_values.EXECUTION__HARD_ERROR.exit_identifier, 'result_subdir': sds.SUB_DIRECTORY__RESULT, 'sandbox': formatting.concept_(concepts.SANDBOX_CONCEPT_INFO), 'ENV_VAR_RESULT': ENV_VAR_RESULT, 'ATC': formatting.concept_(concepts.ACTION_TO_CHECK_CONCEPT_INFO), })
def __init__(self, name: str, instruction_set: SectionInstructionSet): super().__init__(name, instruction_set) self._tp = TextParser({ 'phase': phase_names.PHASE_NAME_DICTIONARY, 'PASS': exit_values.EXECUTION__PASS.exit_identifier, 'FAIL': exit_values.EXECUTION__FAIL.exit_identifier, 'HARD_ERROR': exit_values.EXECUTION__HARD_ERROR.exit_identifier, 'result_subdir': sds.SUB_DIRECTORY__RESULT, 'sandbox': formatting.concept_(concepts.SDS_CONCEPT_INFO), 'ENV_VAR_RESULT': SYMBOL_RESULT, 'ATC': formatting.concept_(concepts.ACTION_TO_CHECK_CONCEPT_INFO), })
def __init__(self, name: str): format_map = { 'current_dir': formatting.concept_(concepts.CURRENT_WORKING_DIRECTORY_CONCEPT_INFO), 'sandbox': formatting.concept_(concepts.SANDBOX_CONCEPT_INFO), 'SOURCE': instruction_arguments.SOURCE_PATH_ARGUMENT.name, 'DESTINATION': instruction_arguments.DESTINATION_PATH_ARGUMENT.name, } super().__init__(name, format_map) self._doc_elements = src_dst.DocumentationElements( format_map, REL_OPTION_ARG_CONF_FOR_SOURCE, the_path_of('an existing file or directory.'), REL_OPTION_ARG_CONF_FOR_DESTINATION, the_path_of('an existing directory, or a non-existing file.') )
def purpose(self) -> DescriptionWithSubSections: tp = TextParser({ 'cd_concept': formatting.concept(self.singular_name()), 'CD': self.acronym(), 'program_name': formatting.program_name(program_info.PROGRAM_NAME), 'sds_concept': formatting.concept_(concepts.SDS_CONCEPT_INFO), 'act_sub_dir': SUB_DIRECTORY__ACT + '/', 'path_type': formatting.symbol_type_(types.PATH_TYPE_INFO), 'act_phase': phase_names.ACT.emphasis, 'rel_cd_option': formatting.cli_option(path.REL_CWD_OPTION), 'cd_instruction': InstructionName(instruction_names.CHANGE_DIR_INSTRUCTION_NAME), 'def_instruction': InstructionName(instruction_names.SYMBOL_DEFINITION_INSTRUCTION_NAME), 'instruction': concepts.INSTRUCTION_CONCEPT_INFO.name, 'os_process': misc_texts.OS_PROCESS_NAME, }) return DescriptionWithSubSections( self.single_line_description(), SectionContents( tp.fnap(_INITIAL_PARAGRAPHS), [ docs.section( tp.text(_USING_THE_CD_HEADER), tp.fnap(_USING_THE_CD) ), docs.section( tp.text(_DESCRIPTION_DEF_INSTRUCTION_HEADER), cd_instruction_section_on_def_instruction() ), ] ))
def _new_argument_parser(self) -> argparse.ArgumentParser: ret_val = argparse.ArgumentParser( description=misc_texts.SUITE_COMMAND_SINGLE_LINE_DESCRIPTION, prog=program_info.PROGRAM_NAME + ' ' + common_opts.SUITE_COMMAND) ret_val.add_argument('file', metavar=opts.TEST_SUITE_FILE_ARGUMENT, type=str, help='The test suite file.') ret_val.add_argument(short_and_long_option_syntax.long_syntax( opts.OPTION_FOR_REPORTER__LONG), metavar=opts.REPORTER_OPTION_ARGUMENT, nargs=1, choices=self.reporter_names, help=self._reporter_option_description()) ret_val.add_argument( short_and_long_option_syntax.long_syntax( common_opts.OPTION_FOR_ACTOR__LONG), metavar=common_opts.ACTOR_OPTION_ARGUMENT, nargs=1, help=_ACTOR_OPTION_DESCRIPTION.format( ARGUMENT=common_opts.ACTOR_OPTION_ARGUMENT, INTERPRETER_ACTOR_TERM=formatting.entity( actors.SOURCE_INTERPRETER_ACTOR.singular_name), ACTOR_CONCEPT=formatting.concept_(concepts.ACTOR_CONCEPT_INFO), is_a_system_cmd=misc_texts.IS_A_SYSTEM_CMD, )) return ret_val
def __init__(self, name: str): super().__init__(name) self._tp = TextParser({ 'program_name': program_info.PROGRAM_NAME, 'phase': phase_names.PHASE_NAME_DICTIONARY, 'setup': phase_infos.SETUP.name, 'act': phase_infos.ACT.name, 'action_to_check': concepts.ACTION_TO_CHECK_CONCEPT_INFO.name, 'home_directory': formatting.conf_param_(conf_params.HDS_CASE_DIRECTORY_CONF_PARAM_INFO), 'sandbox': formatting.concept_(concepts.SDS_CONCEPT_INFO), 'result_dir': tc_fs.SDS_RESULT_INFO.identifier, 'actor_option': OPTION_FOR_ACTOR, 'actor': concepts.ACTOR_CONCEPT_INFO.name, 'actor_instruction': formatting.InstructionName(ACTOR_INSTRUCTION_NAME), 'default_actor': actors.DEFAULT_ACTOR_SINGLE_LINE_VALUE, 'null_actor': formatting.entity_(actors.NULL_ACTOR), 'os_process': misc_texts.OS_PROCESS_NAME, 'instruction': concepts.INSTRUCTION_CONCEPT_INFO.name, 'stdin_instruction': InstructionName(instruction_names.CONTENTS_OF_STDIN_INSTRUCTION_NAME), 'env_instruction': InstructionName(instruction_names.ENV_VAR_INSTRUCTION_NAME), 'timeout': concepts.TIMEOUT_CONCEPT_INFO.name, 'timeout_default': concepts.TIMEOUT_CONCEPT_INFO.default, 'timeout_instruction': InstructionName(instruction_names.TIMEOUT_INSTRUCTION_NAME), 'conf_param': concepts.CONFIGURATION_PARAMETER_CONCEPT_INFO.name, 'env_var': concepts.ENVIRONMENT_VARIABLE_CONCEPT_INFO.name, 'PROGRAM': syntax_elements.PROGRAM_SYNTAX_ELEMENT.singular_name, 'stdin': misc_texts.STDIN, 'directive': concepts.DIRECTIVE_CONCEPT_INFO.name, 'including': formatting.keyword(directives.INCLUDING_DIRECTIVE_INFO.singular_name), })
def __init__(self): self.file = instruction_arguments.FILE_ARGUMENT self.argument = a.Named(help_texts.ARGUMENT) fm = { 'shell_syntax_concept': formatting.concept_(concepts.SHELL_SYNTAX_CONCEPT_INFO), } super().__init__(TextParser(fm))
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')), ])
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')), ])
def __init__(self, actor: ActorDocumentation): self.actor = actor self.rendering_environment = None format_map = { 'actor_concept': formatting.concept_(concepts.ACTOR_CONCEPT_INFO), 'act_phase': phase_names.ACT.emphasis, } self._parser = TextParser(format_map)
def __init__(self, actor: ActorDocumentation): self.actor = actor self.rendering_environment = None format_map = { 'actor_concept': formatting.concept_(concepts.ACTOR_CONCEPT_INFO), 'act_phase': phase_names.ACT.emphasis, } self._parser = TextParser(format_map)
def __init__(self, name: str, instruction_set: SectionInstructionSet): super().__init__(name, instruction_set) self._tp = TextParser({ 'phase': phase_names.PHASE_NAME_DICTIONARY, 'CWD': formatting.concept_(concepts.CURRENT_WORKING_DIRECTORY_CONCEPT_INFO), })
def __init__(self, grammar: Grammar): self.grammar = grammar self.concept_argument = a.Single(a.Multiplicity.MANDATORY, self.grammar.concept.syntax_element) self._tp = TextParser({ 'symbol_concept': formatting.concept_(SYMBOL_CONCEPT_INFO), 'concept_name': self.grammar.concept.name.singular, })
def __init__(self): super().__init__(TypeCategory.DATA, syntax_elements.LIST_SYNTAX_ELEMENT) self._tp = TextParser({ 'string_type': formatting.keyword(types.STRING_TYPE_INFO.name.singular), 'list_type': formatting.keyword(types.LIST_TYPE_INFO.name.singular), 'symbol': formatting.concept_(concepts.SYMBOL_CONCEPT_INFO), })
def __init__(self, name: str, instruction_set: SectionInstructionSet): super().__init__(name, instruction_set) self._tp = TextParser({ 'phase': phase_names.PHASE_NAME_DICTIONARY, 'CWD': formatting.concept_( concepts.CURRENT_WORKING_DIRECTORY_CONCEPT_INFO), })
def _rel_hds(rel: RelHdsOptionType, description: str) -> _RelOptionTypeInfo: ri = REL_HDS_OPTIONS_MAP[rel] return _RelOptionTypeInfo( ri._option_name, formatting.concept_(ri.conf_param_info), description, [ri.conf_param_info], )
def _rel_hds(rel: RelHomeOptionType, description: str) -> _RelOptionTypeInfo: ri = REL_HOME_OPTIONS_MAP[rel] return _RelOptionTypeInfo(ri.option_name, formatting.concept_(ri.conf_param_info), description, [ri.conf_param_info], )
def purpose(self) -> DescriptionWithSubSections: tp = TextParser({ 'reporter_option': formatting.cli_option(OPTION_FOR_REPORTER), 'default_reporter': formatting.entity(reporters.DEFAULT_REPORTER.singular_name), 'suite_reporter': formatting.concept_(concepts.SUITE_REPORTER_CONCEPT_INFO), }) return from_simple_description( Description(self.single_line_description(), tp.fnap(_DESCRIPTION_REST)))
def __init__(self): super().__init__(ENVIRONMENT_VARIABLE_CONCEPT_INFO) self._tp = TextParser({ 'program_name': formatting.program_name(program_info.PROGRAM_NAME), 'env_vars__plain': self.name().plural, 'env_instruction': InstructionName(instruction_names.ENV_VAR_INSTRUCTION_NAME), 'tcds_concept': formatting.concept_(concepts.TEST_CASE_DIRECTORY_STRUCTURE_CONCEPT_INFO), })
def cd_instruction_section_on_def_instruction() -> List[ParagraphItem]: tp = TextParser({ 'current_directory_concept': formatting.concept_(concepts.CURRENT_WORKING_DIRECTORY_CONCEPT_INFO), 'def_instruction': InstructionName(instruction_names.SYMBOL_DEFINITION_INSTRUCTION_NAME), 'symbol_concept': formatting.concept(concepts.SYMBOL_CONCEPT_INFO.singular_name), 'rel_cd_option': formatting.cli_option(file_ref.REL_CWD_OPTION), 'path_type': formatting.keyword(types.PATH_TYPE_INFO.name.singular), }) return tp.fnap(_CD_INSTRUCTION_SECTION_ON_DEF_INSTRUCTION)
def def_instruction_rel_cd_description(path_arg_name: str) -> List[ParagraphItem]: tp = TextParser({ 'current_directory_concept': formatting.concept_( concepts.CURRENT_WORKING_DIRECTORY_CONCEPT_INFO), 'path_arg': path_arg_name, 'symbol_concept': formatting.concept(concepts.SYMBOL_CONCEPT_INFO.singular_name), 'symbols_concept': formatting.concept(concepts.SYMBOL_CONCEPT_INFO.plural_name), }) return tp.fnap(_DEF_INSTRUCTION_REL_CD_DESCRIPTION)
def cd_instruction_section_on_def_instruction() -> List[ParagraphItem]: tp = TextParser({ 'current_directory_concept': formatting.concept_(concepts.CURRENT_WORKING_DIRECTORY_CONCEPT_INFO), 'def_instruction': InstructionName(instruction_names.SYMBOL_DEFINITION_INSTRUCTION_NAME), 'symbol_concept': formatting.concept(concepts.SYMBOL_CONCEPT_INFO.singular_name), 'rel_cd_option': formatting.cli_option(path.REL_CWD_OPTION), 'path_type': types.PATH_TYPE_INFO.name, }) return tp.fnap(_CD_INSTRUCTION_SECTION_ON_DEF_INSTRUCTION)
def __init__(self, name: str): super().__init__( name, { 'preprocessor': formatting.concept_(concepts.PREPROCESSOR_CONCEPT_INFO), 'cmd_line': misc_texts.SYSTEM_COMMAND_LINE.singular, 'is_a_system_cmd': misc_texts.IS_A_SYSTEM_CMD, })
def def_instruction_rel_cd_description(path_arg_name: str) -> List[ParagraphItem]: tp = TextParser({ 'current_directory_concept': formatting.concept_( concepts.CURRENT_WORKING_DIRECTORY_CONCEPT_INFO), 'path_arg': path_arg_name, 'symbol_concept': formatting.concept(concepts.SYMBOL_CONCEPT_INFO.singular_name), 'symbols_concept': formatting.concept(concepts.SYMBOL_CONCEPT_INFO.plural_name), 'Note': headers.NOTE_LINE_HEADER, }) return tp.fnap(_DEF_INSTRUCTION_REL_CD_DESCRIPTION)
def __init__(self, name: str, phase_is_after_act: bool): super().__init__(name, {}) self._src_rel_opt_arg_conf = src_rel_opt_arg_conf_for_phase(phase_is_after_act) format_map = { 'current_dir': formatting.concept_(concepts.CURRENT_WORKING_DIRECTORY_CONCEPT_INFO), 'sandbox': formatting.concept_(concepts.SDS_CONCEPT_INFO), 'SOURCE': self._src_rel_opt_arg_conf.argument.name, 'DESTINATION': REL_OPTION_ARG_CONF_FOR_DESTINATION.argument.name, 'dir_file_type': file_types.DIRECTORY, } super().__init__(name, format_map) self._doc_elements = src_dst.DocumentationElements( format_map, self._src_rel_opt_arg_conf, the_path_of('an existing file or directory.'), REL_OPTION_ARG_CONF_FOR_DESTINATION, the_path_of('an existing directory, or a non-existing path.') )
def path_type_path_rendering() -> SectionItem: tp = TextParser({ 'current_directory_concept': formatting.concept_(concepts.CURRENT_WORKING_DIRECTORY_CONCEPT_INFO), 'def_instruction': InstructionName(instruction_names.SYMBOL_DEFINITION_INSTRUCTION_NAME), 'symbol_concept': formatting.concept(concepts.SYMBOL_CONCEPT_INFO.singular_name), 'rel_cd_option': formatting.cli_option(file_ref.REL_CWD_OPTION), 'path_type': formatting.keyword(types.PATH_TYPE_INFO.name.singular), }) return Section(tp.text(_PATH_TYPE_PATH_RENDERING_DESCRIPTION_HEADER), tp.section_contents(_PATH_TYPE_PATH_RENDERING_DESCRIPTION))
def __init__(self, name: str, instruction_set: SectionInstructionSet): super().__init__(name, instruction_set) self._tp = TextParser({ 'phase': phase_names.PHASE_NAME_DICTIONARY, 'SKIP': NAME_SKIP, 'execution_mode': formatting.conf_param_(conf_params.TEST_CASE_STATUS_CONF_PARAM_INFO), 'ATC': formatting.concept_(concepts.ACTION_TO_CHECK_CONCEPT_INFO), })
def __init__(self, name: str, is_after_act_phase: bool, is_in_assert_phase: bool = False): self.is_after_act_phase = is_after_act_phase self.relativity_options = relativity_options(is_after_act_phase) self.cwd_concept_name = formatting.concept_(concepts.CURRENT_WORKING_DIRECTORY_CONCEPT_INFO) super().__init__(name, { 'cwd_concept': self.cwd_concept_name, 'dir_argument': _DIR_ARGUMENT.name, }, is_in_assert_phase)
def __init__(self): super().__init__(FILE_INTERPRETER_ACTOR) self._tp = TextParser({ 'shell_syntax_concept': formatting.concept_(concepts.SHELL_SYNTAX_CONCEPT_INFO), 'LINE_COMMENT_MARKER': formatting.string_constant(LINE_COMMENT_MARKER), 'ACT_INTERPRETER': formatting.syntax_element( syntax_elements.ACT_INTERPRETER_SYNTAX_ELEMENT.singular_name), })
def __init__(self): super().__init__(concepts.SANDBOX_CONCEPT_INFO) self._tp = TextParser({ 'program_name': formatting.program_name(program_info.PROGRAM_NAME), 'phase': phase_names.PHASE_NAME_DICTIONARY, 'instruction': AnyInstructionNameDictionary(), 'cwd': formatting.concept_(concepts.CURRENT_WORKING_DIRECTORY_CONCEPT_INFO), 'cd_instruction': InstructionName(CHANGE_DIR_INSTRUCTION_NAME), 'keep_sandbox_option': formatting.cli_option(command_line_options.OPTION_FOR_KEEPING_SANDBOX_DIRECTORY), })
def __init__(self, name: str, is_after_act_phase: bool, is_in_assert_phase: bool = False): self.is_after_act_phase = is_after_act_phase self.relativity_options = relativity_options(is_after_act_phase) self.cwd_concept_name = formatting.concept_(concepts.CURRENT_WORKING_DIRECTORY_CONCEPT_INFO) super().__init__(name, { 'cwd_concept': self.cwd_concept_name, 'dir_argument': _DIR_ARGUMENT.name, }, is_in_assert_phase)
def purpose(self) -> DescriptionWithSubSections: tp = TextParser({ 'reporter_option': formatting.cli_option(OPTION_FOR_REPORTER), 'default_reporter': formatting.entity(reporters.DEFAULT_REPORTER.singular_name), 'suite_reporter': formatting.concept_(concepts.SUITE_REPORTER_CONCEPT_INFO), }) return from_simple_description( Description(self.single_line_description(), tp.fnap(_DESCRIPTION_REST)))
def _text_parser() -> TextParser: return TextParser({ 'phase_declaration_for_NAME': section_header('NAME'), 'instr': AnyInstructionNameDictionary(), 'instruction': concepts.INSTRUCTION_CONCEPT_INFO.name, 'instruction_description': defs.INSTRUCTION_DESCRIPTION, 'description_delimiter': defs.DESCRIPTION_DELIMITER, 'description_delimiter_char_name': defs.DESCRIPTION_DELIMITER_CHAR_NAME, 'default_phase': phase_names.PHASE_NAME_DICTIONARY[DEFAULT_PHASE.identifier].syntax, 'phase': phase_names.PHASE_NAME_DICTIONARY, 'actor': formatting.concept_(ACTOR_CONCEPT_INFO), 'CONTENTS_EQUALS_ARGUMENT': contents_opts.EQUALS_ARGUMENT, 'CONTENTS_EMPTY_ARGUMENT': contents_opts.EMPTY_ARGUMENT, 'line_comment_char': LINE_COMMENT_MARKER, 'file_inclusion_directive_in_text': formatting.keyword(directives.INCLUDING_DIRECTIVE_INFO.singular_name), 'file_inclusion_directive': directives.INCLUDING_DIRECTIVE_INFO.singular_name, 'shell_command': formatting.misc_name_with_formatting(misc_texts.SHELL_COMMAND), 'plain_string': misc_texts.PLAIN_STRING, 'instruction__shell_cmd_line': instruction_names.SHELL_INSTRUCTION_NAME, 'instruction__stdout': instruction_names.CONTENTS_OF_STDOUT_INSTRUCTION_NAME, 'instruction__stderr': instruction_names.CONTENTS_OF_STDERR_INSTRUCTION_NAME, 'instruction__exit_code': instruction_names.EXIT_CODE_INSTRUCTION_NAME, 'INT_EQUALS_OPERATOR': comparators.EQ.name, 'HERE_DOCUMENT_MARKER_PREFIX': string.HERE_DOCUMENT_MARKER_PREFIX, 'MARKER': 'EOF', 'sds_result_dir': sds.SUB_DIRECTORY__RESULT, 'sds_stdout_file': sds.RESULT_FILE__STDOUT, })
def __init__(self): self.text_parser = TextParser({ 'program_name': formatting.program_name(program_info.PROGRAM_NAME), 'case_home_directory': formatting.conf_param_(conf_params.HOME_CASE_DIRECTORY_CONF_PARAM_INFO), 'act_home_directory': formatting.concept_(conf_params.HOME_ACT_DIRECTORY_CONF_PARAM_INFO), 'act_sub_dir': sds.SUB_DIRECTORY__ACT, 'tmp_sub_dir': sds.PATH__TMP_USER, 'result_sub_dir': sds.SUB_DIRECTORY__RESULT, 'sandbox': concepts.SANDBOX_CONCEPT_INFO.name, 'conf_param': concepts.CONFIGURATION_PARAMETER_CONCEPT_INFO.name, } ) self.all_variables_dict = dict(ENVIRONMENT_VARIABLES_SET_BEFORE_ACT + ENVIRONMENT_VARIABLES_SET_AFTER_ACT)
def __init__(self, instruction_name: str, checked_file: str, initial_args_of_invokation_variants: List[a.ArgumentUsage]): self._checked_file = checked_file self.instruction_name = instruction_name self.initial_args_of_invokation_variants = initial_args_of_invokation_variants self._tp = TextParser({ 'checked_file': checked_file, 'contents_matcher': formatting.syntax_element_(syntax_elements.STRING_MATCHER_SYNTAX_ELEMENT), 'action_to_check': formatting.concept_(concepts.ACTION_TO_CHECK_CONCEPT_INFO), 'program_type': formatting.symbol_type_(types.PROGRAM_TYPE_INFO), })
def __init__(self, name: str, is_in_assert_phase: bool = False): self.name = syntax_elements.SYMBOL_NAME_SYNTAX_ELEMENT.argument self.string_value = syntax_elements.STRING_SYNTAX_ELEMENT.argument super().__init__(name, { 'NAME': self.name.name, 'current_directory_concept': formatting.concept_( concepts.CURRENT_WORKING_DIRECTORY_CONCEPT_INFO), 'PATH_ARG': _PATH_ARGUMENT.name, 'SYMBOL_CONCEPT': formatting.concept(concepts.SYMBOL_CONCEPT_INFO.singular_name), 'SYMBOLS_CONCEPT': formatting.concept(concepts.SYMBOL_CONCEPT_INFO.plural_name), }, is_in_assert_phase)
def path_type_path_rendering() -> SectionItem: tp = TextParser({ 'current_directory_concept': formatting.concept_(concepts.CURRENT_WORKING_DIRECTORY_CONCEPT_INFO), 'def_instruction': InstructionName(instruction_names.SYMBOL_DEFINITION_INSTRUCTION_NAME), 'symbol_concept': formatting.concept(concepts.SYMBOL_CONCEPT_INFO.singular_name), 'rel_cd_option': formatting.cli_option(path.REL_CWD_OPTION), 'path_type': types.PATH_TYPE_INFO.name, 'external_program': misc_texts.EXTERNAL_PROGRAM, 'os_process': misc_texts.OS_PROCESS_NAME, 'Note': headers.NOTE_LINE_HEADER, }) return Section(tp.text(_PATH_TYPE_PATH_RENDERING_DESCRIPTION_HEADER), tp.section_contents(_PATH_TYPE_PATH_RENDERING_DESCRIPTION))
def __init__(self, name: str, instruction_set: SectionInstructionSet): super().__init__(name, instruction_set) self._tp = TextParser({ 'phase': phase_names.PHASE_NAME_DICTIONARY, 'ATC': formatting.concept_(concepts.ACTION_TO_CHECK_CONCEPT_INFO), 'env_var': concepts.ENVIRONMENT_VARIABLE_CONCEPT_INFO.name, 'env_vars_default': concepts.ENVIRONMENT_VARIABLE_CONCEPT_INFO.default, 'timeout_default': concepts.TIMEOUT_CONCEPT_INFO.default, 'stdin': misc_texts.STDIN, 'SDS': concepts.SDS_CONCEPT_INFO.name, })
def __init__(self, name: str): super().__init__( name, { 'actor': formatting.concept_(concepts.ACTOR_CONCEPT_INFO), 'act_phase': phase_names.ACT.emphasis, 'command_line_actor': formatting.entity_( actors.COMMAND_LINE_ACTOR), 'null_actor': formatting.entity_(actors.NULL_ACTOR), 'ACT_INTERPRETER': syntax_elements.ACT_INTERPRETER_SYNTAX_ELEMENT.singular_name, 'symbol': concepts.SYMBOL_CONCEPT_INFO.name, 'setup': phase_names.SETUP, })
def __init__(self, name: str, single_line_description_un_formatted: str, main_description_rest_un_formatted: str = None): self.command_line_syntax = command_line_actor_help.ActPhaseDocumentationSyntax() self.single_line_description_un_formatted = single_line_description_un_formatted self.main_description_rest_un_formatted = main_description_rest_un_formatted super().__init__(name, { 'EXECUTABLE': self.command_line_syntax.executable.name, 'ARGUMENT': self.command_line_syntax.argument.name, 'actor': formatting.concept_(concepts.ACTOR_CONCEPT_INFO), 'act_phase': phase_names.ACT.emphasis, 'command_line_actor': formatting.entity_(actors.COMMAND_LINE_ACTOR) })
def __init__(self, name: str, instruction_set: SectionInstructionSet): super().__init__(name, instruction_set) self._tp = TextParser({ 'phase': phase_names.PHASE_NAME_DICTIONARY, 'SKIP': NAME_SKIP, 'execution_mode': formatting.conf_param_( conf_params.TEST_CASE_STATUS_CONF_PARAM_INFO), 'ATC': formatting.concept_(concepts.ACTION_TO_CHECK_CONCEPT_INFO), })
def __init__(self, name: str): super().__init__(name, {}) self._tp = TextParser({ 'stdin': misc_texts.STDIN, 'atc': formatting.concept(concepts.ACTION_TO_CHECK_NAME.singular), 'PROGRAM': syntax_elements.PROGRAM_SYNTAX_ELEMENT.singular_name, 'run_program_actor': formatting.entity_(actors.COMMAND_LINE_ACTOR), 'actor': formatting.concept_(concepts.ACTOR_CONCEPT_INFO), })
def _new_argument_parser(self) -> argparse.ArgumentParser: ret_val = argparse.ArgumentParser(description=misc_texts.SUITE_COMMAND_SINGLE_LINE_DESCRIPTION, prog=program_info.PROGRAM_NAME + ' ' + common_opts.SUITE_COMMAND) ret_val.add_argument('file', metavar=opts.TEST_SUITE_FILE_ARGUMENT, type=str, help='The test suite file.') ret_val.add_argument(short_and_long_option_syntax.long_syntax(opts.OPTION_FOR_REPORTER__LONG), metavar=opts.REPORTER_OPTION_ARGUMENT, nargs=1, choices=self.reporter_names, help=self._reporter_option_description()) ret_val.add_argument(short_and_long_option_syntax.long_syntax(common_opts.OPTION_FOR_ACTOR__LONG), metavar=common_opts.ACTOR_OPTION_ARGUMENT, nargs=1, help=_ACTOR_OPTION_DESCRIPTION.format( ARGUMENT=common_opts.ACTOR_OPTION_ARGUMENT, INTERPRETER_ACTOR_TERM=formatting.entity( actors.SOURCE_INTERPRETER_ACTOR.singular_name), ACTOR_CONCEPT=formatting.concept_(concepts.ACTOR_CONCEPT_INFO), shell_syntax_concept=formatting.concept_(concepts.SHELL_SYNTAX_CONCEPT_INFO), )) return ret_val
def purpose(self) -> DescriptionWithSubSections: parse = TextParser({ 'action_to_check': formatting.concept_(concepts.ACTION_TO_CHECK_CONCEPT_INFO), 'actor': self.name(), 'actor_option': formatting.cli_option(common_cli_options.OPTION_FOR_ACTOR), 'actor_instruction': formatting.InstructionName(instruction_names.ACTOR_INSTRUCTION_NAME), 'act': phase_infos.ACT.name, 'default_actor': actors.DEFAULT_ACTOR_SINGLE_LINE_VALUE, 'actor_conf_param': formatting.conf_param_(conf_params.ACTOR_CONF_PARAM_INFO), 'conf_param': concepts.CONFIGURATION_PARAMETER_CONCEPT_INFO.name, }) contents = parse.fnap(_AFTER_SINGLE_LINE_DESCRIPTION) return DescriptionWithSubSections(self.single_line_description(), docs.section_contents(contents))
def __init__(self, name: str, name_of_checked_file: str): self.file_arg = a.Named(parse_here_doc_or_file_ref.CONFIGURATION.argument_syntax_name) self._help_parts = FileContentsCheckerHelp(name, name_of_checked_file, []) super().__init__(name, { 'checked_file': name_of_checked_file, 'action_to_check': formatting.concept_(concepts.ACTION_TO_CHECK_CONCEPT_INFO), 'program_type': formatting.entity_(types.PROGRAM_TYPE_INFO), 'FILE_ARG': self.file_arg.name, }) self.checked_file = name_of_checked_file
def __init__(self): super().__init__(concepts.HDS_CONCEPT_INFO) self._tp = TextParser({ 'HDS': concepts.HDS_CONCEPT_INFO.acronym, 'hds_concept': formatting.concept_(concepts.HDS_CONCEPT_INFO), 'phase': phase_names.PHASE_NAME_DICTIONARY, 'program_name': formatting.program_name(program_info.PROGRAM_NAME), 'symbol': formatting.concept_(concepts.SYMBOL_CONCEPT_INFO), 'symbols': formatting.concept(concepts.SYMBOL_CONCEPT_INFO.plural_name), 'conf_params': formatting.concept( concepts.CONFIGURATION_PARAMETER_CONCEPT_INFO.plural_name), 'PATH': syntax_elements.PATH_SYNTAX_ELEMENT.singular_name, 'Note': headers.NOTE_LINE_HEADER, })
def __init__(self): self._tp = TextParser({ 'test_case_file': 'helloworld.case', 'EXECUTABLE_PROGRAM': PROGRAM_NAME, 'program_name': formatting.program_name(PROGRAM_NAME), 'action_to_check': 'helloworld', 'ATC': formatting.concept_(concepts.ACTION_TO_CHECK_CONCEPT_INFO), 'CONTENTS_EQUALS_ARGUMENT': EQUALS_ARGUMENT, 'INT_EQUALS_OPERATOR': comparators.EQ.name, 'act': phase_names.ACT, 'assert': phase_names.ASSERT, 'PASS': exit_values.EXECUTION__PASS.exit_identifier, 'FAIL': exit_values.EXECUTION__FAIL.exit_identifier, 'stdout_instruction': instruction_names.CONTENTS_OF_STDOUT_INSTRUCTION_NAME, 'exit_code_instruction': instruction_names.EXIT_CODE_INSTRUCTION_NAME, })
def _contents(self) -> Sequence[ParagraphItem]: tp = TextParser({ 'action_to_check': formatting.concept_(concepts.ACTION_TO_CHECK_CONCEPT_INFO), 'actor': self.name(), 'actor_option': formatting.cli_option(common_cli_options.OPTION_FOR_ACTOR), 'actor_instruction': formatting.InstructionName(instruction_names.ACTOR_INSTRUCTION_NAME), 'act': phase_infos.ACT.name, 'default_actor': actors.DEFAULT_ACTOR_SINGLE_LINE_VALUE, 'null_actor': formatting.entity(actors.NULL_ACTOR.singular_name), 'actor_conf_param': formatting.conf_param_(conf_params.ACTOR_CONF_PARAM_INFO), 'conf_param': concepts.CONFIGURATION_PARAMETER_CONCEPT_INFO.name, 'space': misc_texts.WHITESPACE, }) ret_val = list(tp.fnap(_AFTER_SLD__BEFORE_EXAMPLES)) ret_val += atc.atc_examples() ret_val += tp.fnap(_AFTER_SLD__AFTER_EXAMPLES) return ret_val
def __init__(self): super().__init__(TypeCategory.DATA, syntax_elements.STRING_SYNTAX_ELEMENT) self._tp = TextParser({ 'string_type': formatting.keyword(types.STRING_TYPE_INFO.name.singular), 'list_type': formatting.keyword(types.LIST_TYPE_INFO.name.singular), 'path_type': formatting.keyword(types.PATH_TYPE_INFO.name.singular), 'symbol': formatting.concept_(concepts.SYMBOL_CONCEPT_INFO), 'CHR': 'CHARACTER', 'SOFT_Q': token.SOFT_QUOTE_CHAR, 'HARD_Q': token.HARD_QUOTE_CHAR, 'soft_quotes': formatting.concept(token.SOFT_QUOTE_NAME.plural), 'hard_quotes': formatting.concept(token.HARD_QUOTE_NAME.plural), 'SYMBOL_REFERENCE_SYNTAX_ELEMENT': syntax_elements.SYMBOL_REFERENCE_SYNTAX_ELEMENT.singular_name, 'REL_CD_OPTION': file_ref.REL_CWD_OPTION, })
def __init__(self): self.text_parser = TextParser({ 'program_name': formatting.program_name(program_info.PROGRAM_NAME), 'hds_case_directory': formatting.conf_param_( conf_params.HDS_CASE_DIRECTORY_CONF_PARAM_INFO), 'hds_act_directory': formatting.concept_(conf_params.HDS_ACT_DIRECTORY_CONF_PARAM_INFO), 'act_sub_dir': sds.SUB_DIRECTORY__ACT, 'tmp_sub_dir': sds.PATH__TMP_USER, 'result_sub_dir': sds.SUB_DIRECTORY__RESULT, 'sandbox': concepts.SDS_CONCEPT_INFO.name, 'conf_param': concepts.CONFIGURATION_PARAMETER_CONCEPT_INFO.name, }) self.all_variables_dict = dict(SYMBOLS_SET_BEFORE_ACT + SYMBOLS_SET_AFTER_ACT)
def __init__(self): self._tp = TextParser({ 'test_case_file': 'helloworld.case', 'EXECUTABLE_PROGRAM': PROGRAM_NAME, 'program_name': formatting.program_name(PROGRAM_NAME), 'action_to_check': 'helloworld', 'ATC': formatting.concept_(concepts.ACTION_TO_CHECK_CONCEPT_INFO), 'CONTENTS_EQUALS_ARGUMENT': EQUALS_ARGUMENT, 'INT_EQUALS_OPERATOR': comparators.EQ.name, 'act': phase_names.ACT, 'assert': phase_names.ASSERT, 'PASS': exit_values.EXECUTION__PASS.exit_identifier, 'FAIL': exit_values.EXECUTION__FAIL.exit_identifier, 'stdout_instruction': instruction_names.CONTENTS_OF_STDOUT_INSTRUCTION_NAME, 'exit_code_instruction': instruction_names.EXIT_CODE_INSTRUCTION_NAME, 'executable_file': formatting.misc_name_with_formatting(misc_texts.EXECUTABLE_FILE), 'console_style': std_tags.CONSOLE_TEXT, 'HERE_DOCUMENT_MARKER_PREFIX': string.HERE_DOCUMENT_MARKER_PREFIX, 'MARKER': 'EOF', })
def purpose(self) -> DescriptionWithSubSections: tp = TextParser({ 'cd_concept': formatting.concept(self.singular_name()), 'CD': self.acronym(), 'program_name': formatting.program_name(program_info.PROGRAM_NAME), 'sds_concept': formatting.concept_(concepts.SANDBOX_CONCEPT_INFO), 'act_sub_dir': SUB_DIRECTORY__ACT + '/', 'path_type': formatting.symbol_type_(types.PATH_TYPE_INFO), 'act_phase': phase_names.ACT.syntax, 'rel_cd_option': formatting.cli_option(file_ref.REL_CWD_OPTION), 'cd_instruction': InstructionName(instruction_names.CHANGE_DIR_INSTRUCTION_NAME), 'run_instruction': InstructionName(instruction_names.RUN_INSTRUCTION_NAME), 'shell_instruction': InstructionName(instruction_names.SHELL_INSTRUCTION_NAME), 'def_instruction': InstructionName(instruction_names.SYMBOL_DEFINITION_INSTRUCTION_NAME), 'os_process': misc_texts.OS_PROCESS_NAME, }) return DescriptionWithSubSections( self.single_line_description(), SectionContents( tp.fnap(_INITIAL_PARAGRAPHS), [ docs.section( tp.text(_USING_THE_CD_HEADER), tp.fnap(_USING_THE_CD) ), docs.section( tp.text(_DESCRIPTION_DEF_INSTRUCTION_HEADER), cd_instruction_section_on_def_instruction() ), ] ))
_LIST_MAIN_DESCRIPTION_REST = """\ Used for argument lists, etc. Useful when the {ATC} is a program with arguments, and for the {run} instruction, e.g. """ _STRING_MAIN_DESCRIPTION_REST = """\ Used for arbitrary {plain_string} values, relative file names etc. """ _TEXT_PARSER = TextParser({ 'run': InstructionName(instruction_names.RUN_INSTRUCTION_NAME), 'ATC': formatting.concept_(concepts.ACTION_TO_CHECK_CONCEPT_INFO), 'plain_string': misc_texts.PLAIN_STRING, }) STRING_DOCUMENTATION = TypeDocumentation(types.STRING_TYPE_INFO, syntax_elements.STRING_SYNTAX_ELEMENT, _TEXT_PARSER.section_contents(_STRING_MAIN_DESCRIPTION_REST) ) LIST_DOCUMENTATION = TypeDocumentation(types.LIST_TYPE_INFO, syntax_elements.LIST_SYNTAX_ELEMENT, _TEXT_PARSER.section_contents(_LIST_MAIN_DESCRIPTION_REST) ) PATH_DOCUMENTATION = TypeDocumentation(types.PATH_TYPE_INFO, syntax_elements.PATH_SYNTAX_ELEMENT,
) -> 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())), ]) PREAMBLE = '' TEXT_PARSER = TextParser({ 'suite_reporter': formatting.concept_(concepts.SUITE_REPORTER_CONCEPT_INFO), 'exit_code': misc_texts.EXIT_CODE, 'stdout': misc_texts.STDOUT, 'an_exit_identifier': misc_texts.EXIT_IDENTIFIER.singular_determined, }) REPORTING = """\ Outcome is reported via {exit_code:a} and {stdout}. stderr may contain helpful information. Output on stdout is handled by the selected {suite_reporter}.
def _default_reporter_info(self) -> list: if self.suite_reporter.singular_name() == DEFAULT_REPORTER.singular_name: return docs.paras('This is the default {reporter_concept}.'.format( reporter_concept=formatting.concept_(SUITE_REPORTER_CONCEPT_INFO))) else: return []
ri = REL_HDS_OPTIONS_MAP[rel] return _RelOptionTypeInfo( ri._option_name, formatting.concept_(ri.conf_param_info), description, [ri.conf_param_info], ) _ALL = { RelOptionType.REL_TMP: _rel_sds(RelSdsOptionType.REL_TMP, _REL_TMP_DESCRIPTION), RelOptionType.REL_ACT: _rel_sds(RelSdsOptionType.REL_ACT, _REL_ACT_DESCRIPTION), RelOptionType.REL_RESULT: _rel_sds(RelSdsOptionType.REL_RESULT, _REL_RESULT_DESCRIPTION), RelOptionType.REL_CWD: _RelOptionTypeInfo(REL_CWD_INFO._option_name, formatting.concept_(REL_CWD_INFO.cross_ref_info), _REL_CWD_DESCRIPTION, [REL_CWD_INFO.cross_ref_info]), RelOptionType.REL_HDS_CASE: _rel_hds(RelHdsOptionType.REL_HDS_CASE, _REL_HDS_CASE_DESCRIPTION), RelOptionType.REL_HDS_ACT: _rel_hds(RelHdsOptionType.REL_HDS_ACT, _REL_HDS_ACT_DESCRIPTION), } _DEFAULT_RELATIVITY = """\ By default, {path} is relative the {default_relativity_location}. """