示例#1
0
 def test_generate_and_output_SHOULD_output_xhtml(self):
     # ARRANGE #
     application_help = new_application_help(self.TEST_CASE_INSTRUCTION_SET,
                                             self.TEST_SUITE_CONFIGURATION_SECTION_INSTRUCTIONS)
     output_file = io.StringIO()
     # ACT #
     sut.generate_and_output(output_file, application_help)
     # ASSERT #
     actual_output = output_file.getvalue()
     begins_with(DOCTYPE_XHTML1_0).apply(self, actual_output, asrt.MessageBuilder('file output'))
示例#2
0
 def test_generate_and_output_SHOULD_output_xhtml(self):
     # ARRANGE #
     application_help = new_application_help(
         default_instructions_setup.INSTRUCTIONS_SETUP,
         CONFIGURATION_SECTION_INSTRUCTIONS)
     output_file = io.StringIO()
     # ACT #
     sut.generate_and_output(output_file, application_help)
     # ASSERT #
     actual_output = output_file.getvalue()
     begins_with(DOCTYPE_XHTML1_0).apply(self, actual_output,
                                         asrt.MessageBuilder('file output'))
示例#3
0
def definition_of_builtin_symbol(name: str,
                                 value_type: ValueType,
                                 num_refs: int) -> Assertion[str]:
    summary_line = output.summary_of_single(output.SymbolSummary(name,
                                                                 value_type,
                                                                 num_refs))
    return asrt_str.begins_with(''.join([summary_line,
                                         '\n',
                                         MAJOR_BLOCKS_SEPARATOR,
                                         individual.BUILTIN_SYMBOL_DEFINITION_SOURCE_LINE]))
示例#4
0
def _main_program_test_cases() -> list:
    return [
        ProcessTestCase(
            'Generation of html-doc SHOULD exit with 0 exit code '
            'AND output html',
            PlainArrangement([HELP_COMMAND] + arguments_for.html_doc()),
            asrt.And([
                pr.is_result_for_exit_code(0),
                pr.stdout(begins_with(DOCTYPE_XHTML1_0))
            ]))
    ]
def is_result_for_exit_value_on_stderr_and_empty_stdout(
    expected: ExitValue,
    contents_after_exit_value_allowed: bool = False
) -> Assertion[SubProcessResult]:
    exit_value_string = expected.exit_identifier + '\n'
    stderr_expectation = (asrt_str.begins_with(exit_value_string)
                          if contents_after_exit_value_allowed else
                          asrt.equals(exit_value_string))
    return sub_process_result(exitcode=asrt.equals(expected.exit_code),
                              stderr=stderr_expectation,
                              stdout=asrt.equals(''))
示例#6
0
def _main_program_test_cases() -> list:
    return [
        ProcessTestCase('Generation of html-doc SHOULD exit with 0 exit code '
                        'AND output html',
                        PlainArrangement([HELP_COMMAND] + arguments_for.html_doc()),
                        asrt.And([
                            pr.is_result_for_exit_code(0),
                            pr.stdout(begins_with(DOCTYPE_XHTML1_0))
                        ])
                        )
    ]