def _global_test_cases() -> list: return [ ProcessTestCase('help for "case cli syntax" SHOULD be successful', HelpInvokation(arguments_for.case_cli_syntax()), RESULT_IS_SUCCESSFUL), ProcessTestCase('help for "case specification" SHOULD be successful', HelpInvokation(arguments_for.case_specification()), RESULT_IS_SUCCESSFUL), ProcessTestCase( 'help for "case instruction in phase" SHOULD be successful', HelpInvokation( arguments_for.case_instruction_in_phase( phase_identifier.SETUP.identifier, CHANGE_DIR_INSTRUCTION_NAME)), RESULT_IS_SUCCESSFUL), ProcessTestCase( 'help for "phase specification" SHOULD be successful', HelpInvokation( arguments_for.case_phase_for_name( phase_identifier.SETUP.identifier)), RESULT_IS_SUCCESSFUL), ProcessTestCase( 'help for "phase instruction list" SHOULD be successful', HelpInvokation( arguments_for.case_instructions_in_phase( phase_identifier.SETUP.identifier)), RESULT_IS_SUCCESSFUL), ProcessTestCase( 'help for "case instruction list" SHOULD be successful', HelpInvokation(arguments_for.case_instructions()), RESULT_IS_SUCCESSFUL), ProcessTestCase( 'help for "case instruction search" SHOULD be successful', HelpInvokation( arguments_for.case_instruction_search( CHANGE_DIR_INSTRUCTION_NAME)), RESULT_IS_SUCCESSFUL), ]
def test_unknown_phase(self): application_help = application_help_for([ section_documentation('phase', ['instruction-name']) ]) with self.assertRaises(HelpError): sut.parse(application_help, arguments_for.case_instruction_in_phase('non-existing-phase', 'instruction-name'))
def _global_test_cases() -> list: return [ ProcessTestCase('help for "case cli syntax" SHOULD be successful', HelpInvokation(arguments_for.case_cli_syntax()), RESULT_IS_SUCCESSFUL), ProcessTestCase('help for "case specification" SHOULD be successful', HelpInvokation(arguments_for.case_specification()), RESULT_IS_SUCCESSFUL), ProcessTestCase('help for "case instruction in phase" SHOULD be successful', HelpInvokation(arguments_for.case_instruction_in_phase( phase_identifier.SETUP.identifier, CHANGE_DIR_INSTRUCTION_NAME)), RESULT_IS_SUCCESSFUL), ProcessTestCase('help for "phase specification" SHOULD be successful', HelpInvokation(arguments_for.case_phase_for_name(phase_identifier.SETUP.identifier)), RESULT_IS_SUCCESSFUL), ProcessTestCase('help for "phase instruction list" SHOULD be successful', HelpInvokation( arguments_for.case_instructions_in_phase(phase_identifier.SETUP.identifier)), RESULT_IS_SUCCESSFUL), ProcessTestCase('help for "case instruction list" SHOULD be successful', HelpInvokation(arguments_for.case_instructions()), RESULT_IS_SUCCESSFUL), ProcessTestCase('help for "case instruction search" SHOULD be successful', HelpInvokation(arguments_for.case_instruction_search(CHANGE_DIR_INSTRUCTION_NAME)), RESULT_IS_SUCCESSFUL), ]
def synopsises(self) -> List[cli_syntax.Synopsis]: non_entities_help = [ _synopsis([], 'Gives a brief description of the program.'), _synopsis([_c(clo.HELP)], 'Displays this help.'), _synopsis([_c(clo.HTML_DOCUMENTATION)], 'Generates a HTML version of all help information available in the program.'), _synopsis(_ns(arguments_for.case_cli_syntax()), 'Describes the test case command line syntax.'), _synopsis(_ns(arguments_for.case_specification()), 'Specification of the test case functionality.'), _synopsis(_ns(arguments_for.case_phase_for_name('PHASE')), 'Describes a test case phase.'), _synopsis(_ns(arguments_for.case_instructions_in_phase('PHASE')), 'Lists instructions in PHASE.'), _synopsis(_ns(arguments_for.case_instruction_in_phase('PHASE', 'INSTRUCTION')), 'Describes an instruction in a test case phase.'), _synopsis(_ns(arguments_for.case_instructions()), 'Lists instructions per test case phase.'), _synopsis(_ns(arguments_for.case_instruction_search('INSTRUCTION')), 'Describes all test case instructions with the given name.'), _synopsis(_ns(arguments_for.suite_cli_syntax()), 'Describes the test suite command line syntax.'), _synopsis(_ns(arguments_for.suite_specification()), 'Specification of the test suite functionality.'), _synopsis(_ns(arguments_for.suite_section_for_name('SECTION')), 'Describes a test suite section.'), _synopsis(_ns(arguments_for.suite_instruction_in_section('SECTION', 'INSTRUCTION')), 'Describes an instruction in a test suite section.'), _synopsis(_ns(arguments_for.symbol_cli_syntax()), 'Describes the symbol usages report command line syntax.'), ] return non_entities_help + self._entities_help()
def test_unknown_phase(self): application_help = application_help_for( [section_documentation('phase', ['instruction-name'])]) with self.assertRaises(HelpError): sut.parse( application_help, arguments_for.case_instruction_in_phase( 'non-existing-phase', 'instruction-name'))
def test_unknown_instruction(self): application_help = application_help_for([ section_documentation('phase-1', ['instruction']), section_documentation('empty-phase', []), ]) with self.assertRaises(HelpError): sut.parse(application_help, arguments_for.case_instruction_in_phase('empty-phase', 'instruction'))
def test_phase_without_instructions(self): phase_name = 'phase' application_help = application_help_for([ SectionDocumentationForSectionWithoutInstructionsTestImpl(phase_name), ]) with self.assertRaises(HelpError): sut.parse(application_help, arguments_for.case_instruction_in_phase(phase_name, 'instruction'))
def test_unknown_instruction(self): application_help = application_help_for([ section_documentation('phase-1', ['instruction']), section_documentation('empty-phase', []), ]) with self.assertRaises(HelpError): sut.parse( application_help, arguments_for.case_instruction_in_phase( 'empty-phase', 'instruction'))
def test_phase_without_instructions(self): phase_name = 'phase' application_help = application_help_for([ SectionDocumentationForSectionWithoutInstructionsTestImpl( phase_name), ]) with self.assertRaises(HelpError): sut.parse( application_help, arguments_for.case_instruction_in_phase( phase_name, 'instruction'))
def _assert_is_existing_instruction_in_phase( self, application_help: ApplicationHelp, phase_name: str, instruction_name: str): actual = sut.parse( application_help, arguments_for.case_instruction_in_phase(phase_name, instruction_name)) actual = self._check_is_test_case_settings_for_single_instruction( actual) self.assertEqual(actual.name, instruction_name, 'Name of instruction') single_line_desc_str = actual.data.single_line_description() self.assertEqual( single_line_description_that_identifies_instruction_and_section( phase_name, instruction_name), single_line_desc_str, 'The single-line-description in this test is expected to identify (phase,instruction-name)' )
def _assert_is_existing_instruction_in_phase(self, application_help: ApplicationHelp, phase_name: str, instruction_name: str): actual = sut.parse(application_help, arguments_for.case_instruction_in_phase(phase_name, instruction_name)) actual = self._check_is_test_case_settings_for_single_instruction(actual) self.assertEqual(actual.name, instruction_name, 'Name of instruction') single_line_desc_str = actual.data.single_line_description() self.assertEqual(single_line_description_that_identifies_instruction_and_section(phase_name, instruction_name), single_line_desc_str, 'The single-line-description in this test is expected to identify (phase,instruction-name)')
def synopses(self) -> List[cli_syntax.Synopsis]: non_entities_help = [ _synopsis([], 'Gives a brief description of the program.'), _synopsis([_c(clo.HELP)], 'Displays this help.'), _synopsis([ _c(clo.HTML_DOCUMENTATION) ], 'Generates a HTML version of all help information available in the program.' ), _synopsis(_ns(arguments_for.case_cli_syntax()), 'Describes the test case command line syntax.'), _synopsis(_ns(arguments_for.case_specification()), 'Specification of the test case functionality.'), _synopsis(_ns(arguments_for.case_phase_for_name('PHASE')), 'Describes a test case phase.'), _synopsis(_ns(arguments_for.case_instructions_in_phase('PHASE')), 'Lists instructions in PHASE.'), _synopsis( _ns( arguments_for.case_instruction_in_phase( 'PHASE', 'INSTRUCTION')), 'Describes an instruction in a test case phase.'), _synopsis(_ns(arguments_for.case_instructions()), 'Lists instructions per test case phase.'), _synopsis( _ns(arguments_for.case_instruction_search('INSTRUCTION')), 'Describes all test case instructions with the given name.'), _synopsis(_ns(arguments_for.suite_cli_syntax()), 'Describes the test suite command line syntax.'), _synopsis(_ns(arguments_for.suite_specification()), 'Specification of the test suite functionality.'), _synopsis(_ns(arguments_for.suite_section_for_name('SECTION')), 'Describes a test suite section.'), _synopsis( _ns( arguments_for.suite_instruction_in_section( 'SECTION', 'INSTRUCTION')), 'Describes an instruction in a test suite section.'), _synopsis( _ns(arguments_for.symbol_cli_syntax()), 'Describes the symbol usages report command line syntax.'), ] return non_entities_help + self._entities_help()
def visit_test_case_phase_instruction( self, x: concrete_cross_refs.TestCasePhaseInstructionCrossReference): return _command_line_display_for_help_arguments( arguments_for.case_instruction_in_phase(x.phase_name, x.instruction_name))
def visit_test_case_phase_instruction(self, x: concrete_cross_refs.TestCasePhaseInstructionCrossReference): return _command_line_display_for_help_arguments(arguments_for.case_instruction_in_phase(x.phase_name, x.instruction_name))