コード例 #1
0
    def testExampleFileGeneration(self):
        """
        This test uses generate_file() from generators.py to generate
        some HTML as a file.

        It is similar to the reference HTML in
        tdda/examples/reference/file_result.html except that the
        Copyright and Version lines are slightly different.

        As shipped, the test should pass, because the ignore_substrings
        tell it to ignore differences that match appropriate regular
        expressions for those cases.

        Make a change to the generation code in the generate_file function
        in generators.py to change the HTML output.

        The test should then fail and suggest a diff command to run
        to see the difference.

        Rerun with

            python test_using_referencetestcase.py --write-all

        and it should re-write the reference output to match your
        modified results.
        """
        outdir = tempfile.gettempdir()
        outpath = os.path.join(outdir, 'file_result.html')
        generate_file(outpath)
        self.assertTextFileCorrect(outpath, 'file_result.html',
                                   ignore_substrings=['Copyright', 'Version'])
コード例 #2
0
    def testExampleFileGeneration(self):
        """
        This test uses generate_file() from generators.py to generate
        some HTML as a file.

        It is similar to the reference HTML in
        tdda/examples/reference/file_result.html except that the
        Copyright and version lines are slightly different.

        As shipped, the test should pass, because the ignore_patterns
        tell it to ignore those lines.

        Make a change to the generation code in the generate_file function
        in generators.py to change the HTML output.

        The test should then fail and suggest a diff command to run
        to see the difference.

        Rerun with

            python test_using_referencetestcase.py --write-all

        and it should re-write the reference output to match your
        modified results.
        """
        outdir = tempfile.gettempdir()
        outpath = os.path.join(outdir, 'file_result.html')
        generate_file(outpath)
        self.assertTextFileCorrect(outpath,
                                   'file_result.html',
                                   ignore_substrings=['Copyright', 'Version'])
コード例 #3
0
def testExampleFileGeneration(ref):
    """
    This test uses generate_file() from generators.py to generate some
    HTML as a file.

    It is similar to the reference HTML in
    tdda/examples/reference/file_result.html except that the
    Copyright and Version lines are slightly different.

    As shipped, the test should pass, because the ignore_substrings
    tell it to ignore differences that match appropriate regular
    expressions for those cases.

    Make a change to the generation code in the generate_file function
    in generators.py to change the HTML output.

    The test should then fail and suggest a diff command to run
    to see the difference.

    Rerun with

        python test_using_referencepytest.py --write-all

    and it should re-write the reference output to match your
    modified results.

    This test is tagged, so it will run if called with ``--tagged`` or ``-1``.
    """
    outdir = ref.tmp_dir
    outpath = os.path.join(outdir, 'file_result.html')
    generate_file(outpath)
    ref.assertTextFileCorrect(outpath,
                              'file_result.html',
                              ignore_substrings=['Copyright', 'Version'])