Ned Batchelder avatar Ned Batchelder committed 1f52409

Move the test directory to tests to avoid conflicts with the stdlib test package.

Comments (0)

Files changed (348)

test/__init__.py

-"""Automated tests. Run with nosetests."""

test/backtest.py

-"""Add things to old Pythons so I can pretend they are newer, for tests."""
-
-# pylint: disable=W0622
-# (Redefining built-in blah)
-# The whole point of this file is to redefine built-ins, so shut up about it.
-
-import os
-
-# Py2k and 3k don't agree on how to run commands in a subprocess.
-try:
-    import subprocess
-except ImportError:
-    def run_command(cmd, status=0):
-        """Run a command in a subprocess.
-
-        Returns the exit status code and the combined stdout and stderr.
-
-        """
-        _, stdouterr = os.popen4(cmd)
-        return status, stdouterr.read()
-
-else:
-    def run_command(cmd, status=0):
-        """Run a command in a subprocess.
-
-        Returns the exit status code and the combined stdout and stderr.
-
-        """
-        proc = subprocess.Popen(cmd, shell=True,
-                stdin=subprocess.PIPE, stdout=subprocess.PIPE,
-                stderr=subprocess.STDOUT
-                )
-        output, _ = proc.communicate()
-        status = proc.returncode        # pylint: disable=E1101
-
-        # Get the output, and canonicalize it to strings with newlines.
-        if not isinstance(output, str):
-            output = output.decode('utf-8')
-        output = output.replace('\r', '')
-
-        return status, output
-
-# No more execfile in Py3k
-try:
-    execfile = execfile
-except NameError:
-    def execfile(filename, globs):
-        """A Python 3 implementation of execfile."""
-        exec(compile(open(filename).read(), filename, 'exec'), globs)

test/backunittest.py

-"""Implementations of unittest features from the future."""
-
-import difflib, re, sys, unittest
-
-from coverage.backward import set                   # pylint: disable=W0622
-
-
-def _need(method):
-    """Do we need to define our own `method` method?"""
-    return not hasattr(unittest.TestCase, method)
-
-
-class TestCase(unittest.TestCase):
-    """Just like unittest.TestCase, but with assert methods added.
-
-    Designed to be compatible with 3.1 unittest.  Methods are only defined if
-    the builtin `unittest` doesn't have them.
-
-    """
-    if _need('assertTrue'):
-        def assertTrue(self, exp, msg=None):
-            """Assert that `exp` is true."""
-            if not exp:
-                self.fail(msg)
-
-    if _need('assertFalse'):
-        def assertFalse(self, exp, msg=None):
-            """Assert that `exp` is false."""
-            if exp:
-                self.fail(msg)
-
-    if _need('assertIn'):
-        def assertIn(self, member, container, msg=None):
-            """Assert that `member` is in `container`."""
-            if member not in container:
-                msg = msg or ('%r not found in %r' % (member, container))
-                self.fail(msg)
-
-    if _need('assertNotIn'):
-        def assertNotIn(self, member, container, msg=None):
-            """Assert that `member` is not in `container`."""
-            if member in container:
-                msg = msg or ('%r found in %r' % (member, container))
-                self.fail(msg)
-
-    if _need('assertGreater'):
-        def assertGreater(self, a, b, msg=None):
-            """Assert that `a` is greater than `b`."""
-            if not a > b:
-                msg = msg or ('%r not greater than %r' % (a, b))
-                self.fail(msg)
-
-    if _need('assertRaisesRegexp'):
-        def assertRaisesRegexp(self, excClass, regexp, callobj, *args, **kw):
-            """ Just like unittest.TestCase.assertRaises,
-                but checks that the message is right too.
-            """
-            try:
-                callobj(*args, **kw)
-            except excClass:
-                _, exc, _ = sys.exc_info()
-                excMsg = str(exc)
-                if re.search(regexp, excMsg):
-                    # Message provided, and we got the right one: it passes.
-                    return
-                else:
-                    # Message provided, and it didn't match: fail!
-                    raise self.failureException(
-                        "Right exception, wrong message: "
-                            "%r doesn't match %r" % (excMsg, regexp)
-                        )
-            # No need to catch other exceptions: They'll fail the test all by
-            # themselves!
-            else:
-                if hasattr(excClass, '__name__'):
-                    excName = excClass.__name__
-                else:
-                    excName = str(excClass)
-                raise self.failureException(
-                    "Expected to raise %s, didn't get an exception at all" %
-                    excName
-                    )
-
-    if _need('assertSameElements'):
-        def assertSameElements(self, s1, s2):
-            """Assert that the two arguments are equal as sets."""
-            self.assertEqual(set(s1), set(s2))
-
-    if _need('assertRegexpMatches'):
-        def assertRegexpMatches(self, text, regex, msg=None):
-            """Assert that `text` matches `regex`."""
-            m = re.search(regex, text)
-            if not m:
-                msg = msg or ("%r doesn't match %r" % (text, regex))
-                raise self.failureException(msg)
-
-    if _need('assertMultiLineEqual'):
-        def assertMultiLineEqual(self, first, second, msg=None):
-            """Assert that two multi-line strings are equal.
-
-            If they aren't, show a nice diff.
-
-            """
-            # Adapted from Py3.1 unittest.
-            self.assertTrue(isinstance(first, str),
-                    'First argument is not a string')
-            self.assertTrue(isinstance(second, str),
-                    'Second argument is not a string')
-
-            if first != second:
-                message = ''.join(difflib.ndiff(first.splitlines(True),
-                                                    second.splitlines(True)))
-                if msg:
-                    message += " : " + msg
-                self.fail("Multi-line strings are unequal:\n" + message)

test/coveragetest.py

-"""Base test case class for coverage testing."""
-
-import glob, imp, os, random, shlex, shutil, sys, tempfile, textwrap
-
-import coverage
-from coverage.backward import sorted, StringIO      # pylint: disable=W0622
-from coverage.backward import to_bytes
-from coverage.control import _TEST_NAME_FILE
-from test.backtest import run_command
-from test.backunittest import TestCase
-
-class Tee(object):
-    """A file-like that writes to all the file-likes it has."""
-
-    def __init__(self, *files):
-        """Make a Tee that writes to all the files in `files.`"""
-        self._files = files
-        if hasattr(files[0], "encoding"):
-            self.encoding = files[0].encoding
-
-    def write(self, data):
-        """Write `data` to all the files."""
-        for f in self._files:
-            f.write(data)
-
-    if 0:
-        # Use this if you need to use a debugger, though it makes some tests
-        # fail, I'm not sure why...
-        def __getattr__(self, name):
-            return getattr(self._files[0], name)
-
-
-# Status returns for the command line.
-OK, ERR = 0, 1
-
-class CoverageTest(TestCase):
-    """A base class for Coverage test cases."""
-
-    run_in_temp_dir = True
-
-    def setUp(self):
-        super(CoverageTest, self).setUp()
-
-        if _TEST_NAME_FILE:
-            f = open(_TEST_NAME_FILE, "w")
-            f.write("%s_%s" % (self.__class__.__name__, self._testMethodName))
-            f.close()
-
-        # Tell newer unittest implementations to print long helpful messages.
-        self.longMessage = True
-
-        # tearDown will restore the original sys.path
-        self.old_syspath = sys.path[:]
-
-        if self.run_in_temp_dir:
-            # Create a temporary directory.
-            self.noise = str(random.random())[2:]
-            self.temp_root = os.path.join(tempfile.gettempdir(), 'test_cover')
-            self.temp_dir = os.path.join(self.temp_root, self.noise)
-            os.makedirs(self.temp_dir)
-            self.old_dir = os.getcwd()
-            os.chdir(self.temp_dir)
-
-            # Modules should be importable from this temp directory.
-            sys.path.insert(0, '')
-
-            # Keep a counter to make every call to check_coverage unique.
-            self.n = 0
-
-        # Record environment variables that we changed with set_environ.
-        self.environ_undos = {}
-
-        # Capture stdout and stderr so we can examine them in tests.
-        # nose keeps stdout from littering the screen, so we can safely Tee it,
-        # but it doesn't capture stderr, so we don't want to Tee stderr to the
-        # real stderr, since it will interfere with our nice field of dots.
-        self.old_stdout = sys.stdout
-        self.captured_stdout = StringIO()
-        sys.stdout = Tee(sys.stdout, self.captured_stdout)
-        self.old_stderr = sys.stderr
-        self.captured_stderr = StringIO()
-        sys.stderr = self.captured_stderr
-
-        # Record sys.modules here so we can restore it in tearDown.
-        self.old_modules = dict(sys.modules)
-
-    def tearDown(self):
-        super(CoverageTest, self).tearDown()
-
-        # Restore the original sys.path.
-        sys.path = self.old_syspath
-
-        if self.run_in_temp_dir:
-            # Get rid of the temporary directory.
-            os.chdir(self.old_dir)
-            shutil.rmtree(self.temp_root)
-
-        # Restore the environment.
-        self.undo_environ()
-
-        # Restore stdout and stderr
-        sys.stdout = self.old_stdout
-        sys.stderr = self.old_stderr
-
-        self.clean_modules()
-
-    def clean_modules(self):
-        """Remove any new modules imported during the test run.
-
-        This lets us import the same source files for more than one test.
-
-        """
-        for m in [m for m in sys.modules if m not in self.old_modules]:
-            del sys.modules[m]
-
-    def set_environ(self, name, value):
-        """Set an environment variable `name` to be `value`.
-
-        The environment variable is set, and record is kept that it was set,
-        so that `tearDown` can restore its original value.
-
-        """
-        if name not in self.environ_undos:
-            self.environ_undos[name] = os.environ.get(name)
-        os.environ[name] = value
-
-    def original_environ(self, name, if_missing=None):
-        """The environment variable `name` from when the test started."""
-        if name in self.environ_undos:
-            ret = self.environ_undos[name]
-        else:
-            ret = os.environ.get(name)
-        if ret is None:
-            ret = if_missing
-        return ret
-
-    def undo_environ(self):
-        """Undo all the changes made by `set_environ`."""
-        for name, value in self.environ_undos.items():
-            if value is None:
-                del os.environ[name]
-            else:
-                os.environ[name] = value
-
-    def stdout(self):
-        """Return the data written to stdout during the test."""
-        return self.captured_stdout.getvalue()
-
-    def stderr(self):
-        """Return the data written to stderr during the test."""
-        return self.captured_stderr.getvalue()
-
-    def make_file(self, filename, text="", newline=None):
-        """Create a temp file.
-
-        `filename` is the path to the file, including directories if desired,
-        and `text` is the content. If `newline` is provided, it is a string
-        that will be used as the line endings in the created file.
-
-        Returns the path to the file.
-
-        """
-        # Tests that call `make_file` should be run in a temp environment.
-        assert self.run_in_temp_dir
-        text = textwrap.dedent(text)
-        if newline:
-            text = text.replace("\n", newline)
-
-        # Make sure the directories are available.
-        dirs, _ = os.path.split(filename)
-        if dirs and not os.path.exists(dirs):
-            os.makedirs(dirs)
-
-        # Create the file.
-        f = open(filename, 'wb')
-        try:
-            f.write(to_bytes(text))
-        finally:
-            f.close()
-
-        return filename
-
-    def clean_local_file_imports(self):
-        """Clean up the results of calls to `import_local_file`.
-
-        Use this if you need to `import_local_file` the same file twice in
-        one test.
-
-        """
-        # So that we can re-import files, clean them out first.
-        self.clean_modules()
-        # Also have to clean out the .pyc file, since the timestamp
-        # resolution is only one second, a changed file might not be
-        # picked up.
-        for pyc in glob.glob('*.pyc'):
-            os.remove(pyc)
-        if os.path.exists("__pycache__"):
-            shutil.rmtree("__pycache__")
-
-    def import_local_file(self, modname):
-        """Import a local file as a module.
-
-        Opens a file in the current directory named `modname`.py, imports it
-        as `modname`, and returns the module object.
-
-        """
-        modfile = modname + '.py'
-        f = open(modfile, 'r')
-
-        for suff in imp.get_suffixes():
-            if suff[0] == '.py':
-                break
-        try:
-            # pylint: disable=W0631
-            # (Using possibly undefined loop variable 'suff')
-            mod = imp.load_module(modname, f, modfile, suff)
-        finally:
-            f.close()
-        return mod
-
-    def start_import_stop(self, cov, modname):
-        """Start coverage, import a file, then stop coverage.
-
-        `cov` is started and stopped, with an `import_local_file` of
-        `modname` in the middle.
-
-        The imported module is returned.
-
-        """
-        cov.start()
-        try:                                    # pragma: nested
-            # Import the python file, executing it.
-            mod = self.import_local_file(modname)
-        finally:                                # pragma: nested
-            # Stop Coverage.
-            cov.stop()
-        return mod
-
-    def get_module_name(self):
-        """Return the module name to use for this test run."""
-        # We append self.n because otherwise two calls in one test will use the
-        # same filename and whether the test works or not depends on the
-        # timestamps in the .pyc file, so it becomes random whether the second
-        # call will use the compiled version of the first call's code or not!
-        modname = 'coverage_test_' + self.noise + str(self.n)
-        self.n += 1
-        return modname
-
-    # Map chars to numbers for arcz_to_arcs
-    _arcz_map = {'.': -1}
-    _arcz_map.update(dict([(c, ord(c)-ord('0')) for c in '123456789']))
-    _arcz_map.update(dict(
-        [(c, 10+ord(c)-ord('A')) for c in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ']
-        ))
-
-    def arcz_to_arcs(self, arcz):
-        """Convert a compact textual representation of arcs to a list of pairs.
-
-        The text has space-separated pairs of letters.  Period is -1, 1-9 are
-        1-9, A-Z are 10 through 36.  The resulting list is sorted regardless of
-        the order of the input pairs.
-
-        ".1 12 2." --> [(-1,1), (1,2), (2,-1)]
-
-        Minus signs can be included in the pairs:
-
-        "-11, 12, 2-5" --> [(-1,1), (1,2), (2,-5)]
-
-        """
-        arcs = []
-        for pair in arcz.split():
-            asgn = bsgn = 1
-            if len(pair) == 2:
-                a,b = pair
-            else:
-                assert len(pair) == 3
-                if pair[0] == '-':
-                    _,a,b = pair
-                    asgn = -1
-                else:
-                    assert pair[1] == '-'
-                    a,_,b = pair
-                    bsgn = -1
-            arcs.append((asgn*self._arcz_map[a], bsgn*self._arcz_map[b]))
-        return sorted(arcs)
-
-    def assertEqualArcs(self, a1, a2, msg=None):
-        """Assert that the arc lists `a1` and `a2` are equal."""
-        # Make them into multi-line strings so we can see what's going wrong.
-        s1 = "\n".join([repr(a) for a in a1]) + "\n"
-        s2 = "\n".join([repr(a) for a in a2]) + "\n"
-        self.assertMultiLineEqual(s1, s2, msg)
-
-    def check_coverage(self, text, lines=None, missing="", report="",
-            excludes=None, partials="",
-            arcz=None, arcz_missing="", arcz_unpredicted=""):
-        """Check the coverage measurement of `text`.
-
-        The source `text` is run and measured.  `lines` are the line numbers
-        that are executable, or a list of possible line numbers, any of which
-        could match. `missing` are the lines not executed, `excludes` are
-        regexes to match against for excluding lines, and `report` is the text
-        of the measurement report.
-
-        For arc measurement, `arcz` is a string that can be decoded into arcs
-        in the code (see `arcz_to_arcs` for the encoding scheme),
-        `arcz_missing` are the arcs that are not executed, and
-        `arcs_unpredicted` are the arcs executed in the code, but not deducible
-        from the code.
-
-        """
-        # We write the code into a file so that we can import it.
-        # Coverage wants to deal with things as modules with file names.
-        modname = self.get_module_name()
-
-        self.make_file(modname+".py", text)
-
-        arcs = arcs_missing = arcs_unpredicted = None
-        if arcz is not None:
-            arcs = self.arcz_to_arcs(arcz)
-            arcs_missing = self.arcz_to_arcs(arcz_missing or "")
-            arcs_unpredicted = self.arcz_to_arcs(arcz_unpredicted or "")
-
-        # Start up Coverage.
-        cov = coverage.coverage(branch=(arcs_missing is not None))
-        cov.erase()
-        for exc in excludes or []:
-            cov.exclude(exc)
-        for par in partials or []:
-            cov.exclude(par, which='partial')
-
-        mod = self.start_import_stop(cov, modname)
-
-        # Clean up our side effects
-        del sys.modules[modname]
-
-        # Get the analysis results, and check that they are right.
-        analysis = cov._analyze(mod)
-        if lines is not None:
-            if type(lines[0]) == type(1):
-                # lines is just a list of numbers, it must match the statements
-                # found in the code.
-                self.assertEqual(analysis.statements, lines)
-            else:
-                # lines is a list of possible line number lists, one of them
-                # must match.
-                for line_list in lines:
-                    if analysis.statements == line_list:
-                        break
-                else:
-                    self.fail("None of the lines choices matched %r" %
-                                                        analysis.statements
-                        )
-
-            if type(missing) == type(""):
-                self.assertEqual(analysis.missing_formatted(), missing)
-            else:
-                for missing_list in missing:
-                    if analysis.missing_formatted() == missing_list:
-                        break
-                else:
-                    self.fail("None of the missing choices matched %r" %
-                                            analysis.missing_formatted()
-                        )
-
-        if arcs is not None:
-            self.assertEqualArcs(
-                analysis.arc_possibilities(), arcs, "Possible arcs differ"
-                )
-
-            if arcs_missing is not None:
-                self.assertEqualArcs(
-                    analysis.arcs_missing(), arcs_missing,
-                    "Missing arcs differ"
-                    )
-
-            if arcs_unpredicted is not None:
-                self.assertEqualArcs(
-                    analysis.arcs_unpredicted(), arcs_unpredicted,
-                    "Unpredicted arcs differ"
-                    )
-
-        if report:
-            frep = StringIO()
-            cov.report(mod, file=frep)
-            rep = " ".join(frep.getvalue().split("\n")[2].split()[1:])
-            self.assertEqual(report, rep)
-
-    def nice_file(self, *fparts):
-        """Canonicalize the filename composed of the parts in `fparts`."""
-        fname = os.path.join(*fparts)
-        return os.path.normcase(os.path.abspath(os.path.realpath(fname)))
-
-    def assert_same_files(self, flist1, flist2):
-        """Assert that `flist1` and `flist2` are the same set of file names."""
-        flist1_nice = [self.nice_file(f) for f in flist1]
-        flist2_nice = [self.nice_file(f) for f in flist2]
-        self.assertSameElements(flist1_nice, flist2_nice)
-
-    def assert_exists(self, fname):
-        """Assert that `fname` is a file that exists."""
-        msg = "File %r should exist" % fname
-        self.assert_(os.path.exists(fname), msg)
-
-    def assert_doesnt_exist(self, fname):
-        """Assert that `fname` is a file that doesn't exist."""
-        msg = "File %r shouldn't exist" % fname
-        self.assert_(not os.path.exists(fname), msg)
-
-    def command_line(self, args, ret=OK, _covpkg=None):
-        """Run `args` through the command line.
-
-        Use this when you want to run the full coverage machinery, but in the
-        current process.  Exceptions may be thrown from deep in the code.
-        Asserts that `ret` is returned by `CoverageScript.command_line`.
-
-        Compare with `run_command`.
-
-        Returns None.
-
-        """
-        script = coverage.CoverageScript(_covpkg=_covpkg)
-        ret_actual = script.command_line(shlex.split(args))
-        self.assertEqual(ret_actual, ret)
-
-    def run_command(self, cmd):
-        """Run the command-line `cmd` in a subprocess, and print its output.
-
-        Use this when you need to test the process behavior of coverage.
-
-        Compare with `command_line`.
-
-        Returns the process' stdout text.
-
-        """
-        _, output = self.run_command_status(cmd)
-        return output
-
-    def run_command_status(self, cmd, status=0):
-        """Run the command-line `cmd` in a subprocess, and print its output.
-
-        Use this when you need to test the process behavior of coverage.
-
-        Compare with `command_line`.
-
-        Returns a pair: the process' exit status and stdout text.
-
-        The `status` argument is returned as the status on older Pythons where
-        we can't get the actual exit status of the process.
-
-        """
-        # Add our test modules directory to PYTHONPATH.  I'm sure there's too
-        # much path munging here, but...
-        here = os.path.dirname(self.nice_file(coverage.__file__, ".."))
-        testmods = self.nice_file(here, 'test/modules')
-        zipfile = self.nice_file(here, 'test/zipmods.zip')
-        pypath = os.getenv('PYTHONPATH', '')
-        if pypath:
-            pypath += os.pathsep
-        pypath += testmods + os.pathsep + zipfile
-        self.set_environ('PYTHONPATH', pypath)
-
-        status, output = run_command(cmd, status=status)
-        print(output)
-        return status, output

test/covmodzip1.py

-"""covmodzip.py: for putting into a zip file."""
-j = 1
-j += 1
Add a comment to this file

test/eggsrc/egg1/__init__.py

Empty file removed.

test/eggsrc/egg1/egg1.py

-# My egg file!
-
-walrus = "Eggman"
-says = "coo-coo cachoo"

test/eggsrc/setup.py

-from setuptools import setup
-
-setup(
-    name="covtestegg1",
-    packages=['egg1'],
-    zip_safe=True,
-    install_requires=[],
-    )

test/farm/annotate/annotate_dir.py

-copy("src", "run")
-run("""
-    coverage -e -x multi.py
-    coverage -a -d out_anno_dir
-    """, rundir="run")
-compare("run/out_anno_dir", "gold_anno_dir", "*,cover", left_extra=True)
-clean("run")

test/farm/annotate/gold/white.py,cover

-  # A test case sent to me by Steve White
-  
-> def f(self):
-!     if self==1:
-!         pass
-!     elif self.m('fred'):
-!         pass
-!     elif (g==1) and (b==2):
-!         pass
-!     elif self.m('fred')==True:
-!         pass
-!     elif ((g==1) and (b==2))==True:
-!         pass
-!     else:
-!         pass
-  
-> def g(x):
->     if x == 1:
->         a = 1
-!     else:
-!         a = 2
-  
-> g(1)
-  
-> def h(x):
--     if 0:   #pragma: no cover
--         pass
->     if x == 1:
-!         a = 1
->     else:
->         a = 2
-  
-> h(2)
Add a comment to this file

test/farm/annotate/gold_anno_dir/a___init__.py,cover

Empty file removed.

test/farm/annotate/gold_anno_dir/a_a.py,cover

-> def a(x):
->     if x == 1:
->         print("x is 1")
-!     else:
-!         print("x is not 1")
Add a comment to this file

test/farm/annotate/gold_anno_dir/b___init__.py,cover

Empty file removed.

test/farm/annotate/gold_anno_dir/b_b.py,cover

-> def b(x):
->     msg = "x is %s" % x
->     print(msg)

test/farm/annotate/gold_anno_dir/multi.py,cover

-> import a.a
-> import b.b
-  
-> a.a.a(1)
-> b.b.b(2)
Add a comment to this file

test/farm/annotate/gold_multi/a/__init__.py,cover

Empty file removed.

test/farm/annotate/gold_multi/a/a.py,cover

-> def a(x):
->     if x == 1:
->         print "x is 1"
-!     else:
-!         print "x is not 1"
Add a comment to this file

test/farm/annotate/gold_multi/b/__init__.py,cover

Empty file removed.

test/farm/annotate/gold_multi/b/b.py,cover

-> def b(x):
->     print "x is %s" % x

test/farm/annotate/gold_multi/multi.py,cover

-> import a.a
-> import b.b
-  
-> a.a.a(1)
-> b.b.b(2)

test/farm/annotate/gold_v24/white.py,cover

-  # A test case sent to me by Steve White
-  
-> def f(self):
-!     if self==1:
-!         pass
-!     elif self.m('fred'):
-!         pass
-!     elif (g==1) and (b==2):
-!         pass
-!     elif self.m('fred')==True:
-!         pass
-!     elif ((g==1) and (b==2))==True:
-!         pass
->     else:
-!         pass
-  
-> def g(x):
->     if x == 1:
->         a = 1
-!     else:
-!         a = 2
-  
-> g(1)
-  
-> def h(x):
--     if 0:   #pragma: no cover
--         pass
->     if x == 1:
-!         a = 1
->     else:
->         a = 2
-  
-> h(2)

test/farm/annotate/run.py

-copy("src", "out")
-run("""
-    coverage -e -x white.py
-    coverage -a white.py
-    """, rundir="out")
-compare("out", "gold", "*,cover")
-clean("out")

test/farm/annotate/run_multi.py

-copy("src", "out_multi")
-run("""
-    coverage -e -x multi.py
-    coverage -a
-    """, rundir="out_multi")
-compare("out_multi", "gold_multi", "*,cover")
-clean("out_multi")
Add a comment to this file

test/farm/annotate/src/a/__init__.py

Empty file removed.

test/farm/annotate/src/a/a.py

-def a(x):
-    if x == 1:
-        print("x is 1")
-    else:
-        print("x is not 1")
Add a comment to this file

test/farm/annotate/src/b/__init__.py

Empty file removed.

test/farm/annotate/src/b/b.py

-def b(x):
-    msg = "x is %s" % x
-    print(msg)

test/farm/annotate/src/multi.py

-import a.a
-import b.b
-
-a.a.a(1)
-b.b.b(2)

test/farm/annotate/src/white.py

-# A test case sent to me by Steve White
-
-def f(self):
-    if self==1:
-        pass
-    elif self.m('fred'):
-        pass
-    elif (g==1) and (b==2):
-        pass
-    elif self.m('fred')==True:
-        pass
-    elif ((g==1) and (b==2))==True:
-        pass
-    else:
-        pass
-
-def g(x):
-    if x == 1:
-        a = 1
-    else:
-        a = 2
-
-g(1)
-
-def h(x):
-    if 0:   #pragma: no cover
-        pass
-    if x == 1:
-        a = 1
-    else:
-        a = 2
-
-h(2)

test/farm/html/gold_a/a.html

-<!doctype html PUBLIC "-//W3C//DTD html 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-    <meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
-    
-    
-    <meta http-equiv='X-UA-Compatible' content='IE=emulateIE7' />
-    <title>Coverage for a: 67%</title>
-    <link rel='stylesheet' href='style.css' type='text/css'>
-    <script type='text/javascript' src='jquery-1.4.3.min.js'></script>
-    <script type='text/javascript' src='jquery.hotkeys.js'></script>
-    <script type='text/javascript' src='jquery.isonscreen.js'></script>
-    <script type='text/javascript' src='coverage_html.js'></script>
-    <script type='text/javascript' charset='utf-8'>
-        jQuery(document).ready(coverage.pyfile_ready);
-    </script>
-</head>
-<body id='pyfile'>
-
-<div id='header'>
-    <div class='content'>
-        <h1>Coverage for <b>a</b> :
-            <span class='pc_cov'>67%</span>
-        </h1>
-        <img id='keyboard_icon' src='keybd_closed.png'>
-        <h2 class='stats'>
-            3 statements
-            <span class='run hide_run shortkey_r' onclick='coverage.toggle_lines(this, "run")'>2 run</span>
-            <span class='mis shortkey_m' onclick='coverage.toggle_lines(this, "mis")'>1 missing</span>
-            <span class='exc shortkey_x' onclick='coverage.toggle_lines(this, "exc")'>0 excluded</span>
-            
-        </h2>
-    </div>
-</div>
-
-<div class='help_panel'>
-    <img id='panel_icon' src='keybd_open.png'>
-<p class='legend'>Hot-keys on this page</p>
-    <div>
-<p class='keyhelp'>
-        <span class='key'>r</span>
-        <span class='key'>m</span>
-        <span class='key'>x</span>
-        <span class='key'>p</span> &nbsp; toggle line displays
-    </p>
-<p class='keyhelp'>
-        <span class='key'>j</span>
-        <span class='key'>k</span> &nbsp; next/prev highlighted chunk
-    </p>
-<p class='keyhelp'>
-        <span class='key'>0</span> &nbsp; (zero) top of page
-    </p>
-<p class='keyhelp'>
-        <span class='key'>1</span> &nbsp; (one) first highlighted chunk
-    </p>
-    </div>
-</div>
-
-<div id='source'>
-    <table cellspacing='0' cellpadding='0'>
-        <tr>
-            <td class='linenos' valign='top'>
-<p id='n1' class='pln'><a href='#n1'>1</a></p>
-<p id='n2' class='pln'><a href='#n2'>2</a></p>
-<p id='n3' class='stm run hide_run'><a href='#n3'>3</a></p>
-<p id='n4' class='pln'><a href='#n4'>4</a></p>
-<p id='n5' class='stm run hide_run'><a href='#n5'>5</a></p>
-<p id='n6' class='pln'><a href='#n6'>6</a></p>
-<p id='n7' class='stm mis'><a href='#n7'>7</a></p>
-                
-            </td>
-            <td class='text' valign='top'>
-<p id='t1' class='pln'><span class='com'># A test file for HTML reporting by coverage.</span><span class='strut'>&nbsp;</span></p>
-<p id='t2' class='pln'><span class='strut'>&nbsp;</span></p>
-<p id='t3' class='stm run hide_run'><span class='key'>if</span> <span class='num'>1</span> <span class='op'>&lt;</span> <span class='num'>2</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
-<p id='t4' class='pln'>&nbsp; &nbsp; <span class='com'># Needed a &lt; to look at HTML entities.</span><span class='strut'>&nbsp;</span></p>
-<p id='t5' class='stm run hide_run'>&nbsp; &nbsp; <span class='nam'>a</span> <span class='op'>=</span> <span class='num'>3</span><span class='strut'>&nbsp;</span></p>
-<p id='t6' class='pln'><span class='key'>else</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
-<p id='t7' class='stm mis'>&nbsp; &nbsp; <span class='nam'>a</span> <span class='op'>=</span> <span class='num'>4</span><span class='strut'>&nbsp;</span></p>
-                
-            </td>
-        </tr>
-    </table>
-</div>
-
-<div id='footer'>
-    <div class='content'>
-        <p>
-            <a class='nav' href='index.html'>&#xab; index</a> &nbsp; &nbsp; <a class='nav' href='http://nedbatchelder.com/code/coverage/3.5a1'>coverage.py v3.5a1</a>
-        </p>
-    </div>
-</div>
-
-</body>
-</html>

test/farm/html/gold_a/index.html

-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-    <meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
-    <title>Coverage report</title>
-    <link rel='stylesheet' href='style.css' type='text/css'>
-    <script type='text/javascript' src='jquery-1.4.3.min.js'></script>
-    <script type='text/javascript' src='jquery.tablesorter.min.js'></script>
-    <script type='text/javascript' src='jquery.hotkeys.js'></script>
-    <script type='text/javascript' src='coverage_html.js'></script>
-    <script type='text/javascript' charset='utf-8'>
-        jQuery(document).ready(coverage.index_ready);
-    </script>
-</head>
-<body id='indexfile'>
-
-<div id='header'>
-    <div class='content'>
-        <h1>Coverage report:
-            <span class='pc_cov'>67%</span>
-        </h1>
-        <img id='keyboard_icon' src='keybd_closed.png'>
-    </div>
-</div>
-
-<div class='help_panel'>
-    <img id='panel_icon' src='keybd_open.png'>
-    <p class='legend'>Hot-keys on this page</p>
-    <div>
-    <p class='keyhelp'>
-        <span class='key'>n</span>
-        <span class='key'>s</span>
-        <span class='key'>m</span>
-        <span class='key'>x</span>
-        
-        <span class='key'>c</span> &nbsp; change column sorting
-    </p>
-    </div>
-</div>
-
-<div id='index'>
-    <table class='index'>
-        <thead>
-            
-            <tr class='tablehead' title='Click to sort'>
-                <th class='name left headerSortDown shortkey_n'>Module</th>
-                <th class='shortkey_s'>statements</th>
-                <th class='shortkey_m'>missing</th>
-                <th class='shortkey_x'>excluded</th>
-                
-                <th class='right shortkey_c'>coverage</th>
-            </tr>
-        </thead>
-        
-        <tfoot>
-            <tr class='total'>
-                <td class='name left'>Total</td>
-                <td>3</td>
-                <td>1</td>
-                <td>0</td>
-                
-                <td class='right'>67%</td>
-            </tr>
-        </tfoot>
-        <tbody>
-            
-            <tr class='file'>
-                <td class='name left'><a href='a.html'>a</a></td>
-                <td>3</td>
-                <td>1</td>
-                <td>0</td>
-                
-                <td class='right'>67%</td>
-            </tr>
-            
-        </tbody>
-    </table>
-</div>
-
-<div id='footer'>
-    <div class='content'>
-        <p>
-            <a class='nav' href='http://nedbatchelder.com/code/coverage/3.5a1'>coverage.py v3.5a1</a>
-        </p>
-    </div>
-</div>
-
-</body>
-</html>

test/farm/html/gold_b_branch/b.html

-<!doctype html PUBLIC "-//W3C//DTD html 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-    <meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
-    
-    
-    <meta http-equiv='X-UA-Compatible' content='IE=emulateIE7' />
-    <title>Coverage for b: 76%</title>
-    <link rel='stylesheet' href='style.css' type='text/css'>
-    <script type='text/javascript' src='jquery-1.4.3.min.js'></script>
-    <script type='text/javascript' src='jquery.hotkeys.js'></script>
-    <script type='text/javascript' src='jquery.isonscreen.js'></script>
-    <script type='text/javascript' src='coverage_html.js'></script>
-    <script type='text/javascript' charset='utf-8'>
-        jQuery(document).ready(coverage.pyfile_ready);
-    </script>
-</head>
-<body id='pyfile'>
-
-<div id='header'>
-    <div class='content'>
-        <h1>Coverage for <b>b</b> :
-            <span class='pc_cov'>76%</span>
-        </h1>
-        <img id='keyboard_icon' src='keybd_closed.png'>
-        <h2 class='stats'>
-            16 statements
-            <span class='run hide_run shortkey_r' onclick='coverage.toggle_lines(this, "run")'>14 run</span>
-            <span class='mis shortkey_m' onclick='coverage.toggle_lines(this, "mis")'>2 missing</span>
-            <span class='exc shortkey_x' onclick='coverage.toggle_lines(this, "exc")'>0 excluded</span>
-            
-                <span class='par run hide_run shortkey_p' onclick='coverage.toggle_lines(this, "par")'>3 partial</span>
-            
-        </h2>
-    </div>
-</div>
-
-<div class='help_panel'>
-    <img id='panel_icon' src='keybd_open.png'>
-<p class='legend'>Hot-keys on this page</p>
-    <div>
-<p class='keyhelp'>
-        <span class='key'>r</span>
-        <span class='key'>m</span>
-        <span class='key'>x</span>
-        <span class='key'>p</span> &nbsp; toggle line displays
-    </p>
-<p class='keyhelp'>
-        <span class='key'>j</span>
-        <span class='key'>k</span> &nbsp; next/prev highlighted chunk
-    </p>
-<p class='keyhelp'>
-        <span class='key'>0</span> &nbsp; (zero) top of page
-    </p>
-<p class='keyhelp'>
-        <span class='key'>1</span> &nbsp; (one) first highlighted chunk
-    </p>
-    </div>
-</div>
-
-<div id='source'>
-    <table cellspacing='0' cellpadding='0'>
-        <tr>
-            <td class='linenos' valign='top'>
-<p id='n1' class='pln'><a href='#n1'>1</a></p>
-<p id='n2' class='pln'><a href='#n2'>2</a></p>
-<p id='n3' class='stm run hide_run'><a href='#n3'>3</a></p>
-<p id='n4' class='pln'><a href='#n4'>4</a></p>
-<p id='n5' class='stm par run hide_run'><a href='#n5'>5</a></p>
-<p id='n6' class='stm run hide_run'><a href='#n6'>6</a></p>
-<p id='n7' class='pln'><a href='#n7'>7</a></p>
-<p id='n8' class='stm mis'><a href='#n8'>8</a></p>
-<p id='n9' class='pln'><a href='#n9'>9</a></p>
-<p id='n10' class='stm run hide_run'><a href='#n10'>10</a></p>
-<p id='n11' class='pln'><a href='#n11'>11</a></p>
-<p id='n12' class='stm run hide_run'><a href='#n12'>12</a></p>
-<p id='n13' class='pln'><a href='#n13'>13</a></p>
-<p id='n14' class='stm par run hide_run'><a href='#n14'>14</a></p>
-<p id='n15' class='stm run hide_run'><a href='#n15'>15</a></p>
-<p id='n16' class='pln'><a href='#n16'>16</a></p>
-<p id='n17' class='stm run hide_run'><a href='#n17'>17</a></p>
-<p id='n18' class='pln'><a href='#n18'>18</a></p>
-<p id='n19' class='stm run hide_run'><a href='#n19'>19</a></p>
-<p id='n20' class='pln'><a href='#n20'>20</a></p>
-<p id='n21' class='stm par run hide_run'><a href='#n21'>21</a></p>
-<p id='n22' class='stm run hide_run'><a href='#n22'>22</a></p>
-<p id='n23' class='stm run hide_run'><a href='#n23'>23</a></p>
-<p id='n24' class='pln'><a href='#n24'>24</a></p>
-<p id='n25' class='stm mis'><a href='#n25'>25</a></p>
-<p id='n26' class='stm run hide_run'><a href='#n26'>26</a></p>
-<p id='n27' class='pln'><a href='#n27'>27</a></p>
-<p id='n28' class='stm run hide_run'><a href='#n28'>28</a></p>
-                
-            </td>
-            <td class='text' valign='top'>
-<p id='t1' class='pln'><span class='com'># A test file for HTML reporting by coverage.</span><span class='strut'>&nbsp;</span></p>
-<p id='t2' class='pln'><span class='strut'>&nbsp;</span></p>
-<p id='t3' class='stm run hide_run'><span class='key'>def</span> <span class='nam'>one</span><span class='op'>(</span><span class='nam'>x</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
-<p id='t4' class='pln'>&nbsp; &nbsp; <span class='com'># This will be a branch that misses the else.</span><span class='strut'>&nbsp;</span></p>
-<p id='t5' class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>8</span>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>x</span> <span class='op'>&lt;</span> <span class='num'>2</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
-<p id='t6' class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>a</span> <span class='op'>=</span> <span class='num'>3</span><span class='strut'>&nbsp;</span></p>
-<p id='t7' class='pln'>&nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
-<p id='t8' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>a</span> <span class='op'>=</span> <span class='num'>4</span><span class='strut'>&nbsp;</span></p>
-<p id='t9' class='pln'><span class='strut'>&nbsp;</span></p>
-<p id='t10' class='stm run hide_run'><span class='nam'>one</span><span class='op'>(</span><span class='num'>1</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
-<p id='t11' class='pln'><span class='strut'>&nbsp;</span></p>
-<p id='t12' class='stm run hide_run'><span class='key'>def</span> <span class='nam'>two</span><span class='op'>(</span><span class='nam'>x</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
-<p id='t13' class='pln'>&nbsp; &nbsp; <span class='com'># A missed else that branches to &quot;exit&quot;</span><span class='strut'>&nbsp;</span></p>
-<p id='t14' class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>exit</span>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>x</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
-<p id='t15' class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>a</span> <span class='op'>=</span> <span class='num'>5</span><span class='strut'>&nbsp;</span></p>
-<p id='t16' class='pln'><span class='strut'>&nbsp;</span></p>
-<p id='t17' class='stm run hide_run'><span class='nam'>two</span><span class='op'>(</span><span class='num'>1</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
-<p id='t18' class='pln'><span class='strut'>&nbsp;</span></p>
-<p id='t19' class='stm run hide_run'><span class='key'>def</span> <span class='nam'>three_way</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
-<p id='t20' class='pln'>&nbsp; &nbsp; <span class='com'># for-else can be a three-way branch.</span><span class='strut'>&nbsp;</span></p>
-<p id='t21' class='stm par run hide_run'><span class='annotate' title='no jumps to these line numbers'>25&nbsp;&nbsp; 26</span>&nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>i</span> <span class='key'>in</span> <span class='nam'>range</span><span class='op'>(</span><span class='num'>10</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
-<p id='t22' class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>i</span> <span class='op'>==</span> <span class='num'>3</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
-<p id='t23' class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>break</span><span class='strut'>&nbsp;</span></p>
-<p id='t24' class='pln'>&nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
-<p id='t25' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='num'>23</span><span class='strut'>&nbsp;</span></p>
-<p id='t26' class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>return</span> <span class='num'>17</span><span class='strut'>&nbsp;</span></p>
-<p id='t27' class='pln'><span class='strut'>&nbsp;</span></p>
-<p id='t28' class='stm run hide_run'><span class='nam'>three_way</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
-                
-            </td>
-        </tr>
-    </table>
-</div>
-
-<div id='footer'>
-    <div class='content'>
-        <p>
-            <a class='nav' href='index.html'>&#xab; index</a> &nbsp; &nbsp; <a class='nav' href='http://nedbatchelder.com/code/coverage/3.5a1'>coverage.py v3.5a1</a>
-        </p>
-    </div>
-</div>
-
-</body>
-</html>

test/farm/html/gold_b_branch/index.html

-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-    <meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
-    <title>Coverage report</title>
-    <link rel='stylesheet' href='style.css' type='text/css'>
-    <script type='text/javascript' src='jquery-1.4.3.min.js'></script>
-    <script type='text/javascript' src='jquery.tablesorter.min.js'></script>
-    <script type='text/javascript' src='jquery.hotkeys.js'></script>
-    <script type='text/javascript' src='coverage_html.js'></script>
-    <script type='text/javascript' charset='utf-8'>
-        jQuery(document).ready(coverage.index_ready);
-    </script>
-</head>
-<body id='indexfile'>
-
-<div id='header'>
-    <div class='content'>
-        <h1>Coverage report:
-            <span class='pc_cov'>76%</span>
-        </h1>
-        <img id='keyboard_icon' src='keybd_closed.png'>
-    </div>
-</div>
-
-<div class='help_panel'>
-    <img id='panel_icon' src='keybd_open.png'>
-    <p class='legend'>Hot-keys on this page</p>
-    <div>
-    <p class='keyhelp'>
-        <span class='key'>n</span>
-        <span class='key'>s</span>
-        <span class='key'>m</span>
-        <span class='key'>x</span>
-        
-        <span class='key'>b</span>
-        <span class='key'>p</span>
-        
-        <span class='key'>c</span> &nbsp; change column sorting
-    </p>
-    </div>
-</div>
-
-<div id='index'>
-    <table class='index'>
-        <thead>
-            
-            <tr class='tablehead' title='Click to sort'>
-                <th class='name left headerSortDown shortkey_n'>Module</th>
-                <th class='shortkey_s'>statements</th>
-                <th class='shortkey_m'>missing</th>
-                <th class='shortkey_x'>excluded</th>
-                
-                <th class='shortkey_b'>branches</th>
-                <th class='shortkey_p'>partial</th>
-                
-                <th class='right shortkey_c'>coverage</th>
-            </tr>
-        </thead>
-        
-        <tfoot>
-            <tr class='total'>
-                <td class='name left'>Total</td>
-                <td>16</td>
-                <td>2</td>
-                <td>0</td>
-                
-                <td>9</td>
-                <td>4</td>
-                
-                <td class='right'>76%</td>
-            </tr>
-        </tfoot>
-        <tbody>
-            
-            <tr class='file'>
-                <td class='name left'><a href='b.html'>b</a></td>
-                <td>16</td>
-                <td>2</td>
-                <td>0</td>
-                
-                <td>9</td>
-                <td>4</td>
-                
-                <td class='right'>76%</td>
-            </tr>
-            
-        </tbody>
-    </table>
-</div>
-
-<div id='footer'>
-    <div class='content'>
-        <p>
-            <a class='nav' href='http://nedbatchelder.com/code/coverage/3.5a1'>coverage.py v3.5a1</a>
-        </p>
-    </div>
-</div>
-
-</body>
-</html>

test/farm/html/gold_bom/bom.html

-<!doctype html PUBLIC "-//W3C//DTD html 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-    <meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
-    
-    
-    <meta http-equiv='X-UA-Compatible' content='IE=emulateIE7' />
-    <title>Coverage for bom: 71%</title>
-    <link rel='stylesheet' href='style.css' type='text/css'>
-    
-    <script type='text/javascript' src='jquery-1.4.3.min.js'></script>
-    <script type='text/javascript' src='jquery.hotkeys.js'></script>
-    <script type='text/javascript' src='jquery.isonscreen.js'></script>
-    <script type='text/javascript' src='coverage_html.js'></script>
-    <script type='text/javascript' charset='utf-8'>
-        jQuery(document).ready(coverage.pyfile_ready);
-    </script>
-</head>
-<body id='pyfile'>
-
-<div id='header'>
-    <div class='content'>
-        <h1>Coverage for <b>bom</b> :
-            <span class='pc_cov'>71%</span>
-        </h1>
-        <img id='keyboard_icon' src='keybd_closed.png'>
-        <h2 class='stats'>
-            7 statements &nbsp;
-            <span class='run hide_run shortkey_r button_toggle_run'>5 run</span>
-            <span class='mis shortkey_m button_toggle_mis'>2 missing</span>
-            <span class='exc shortkey_x button_toggle_exc'>0 excluded</span>
-            
-        </h2>
-    </div>
-</div>
-
-<div class='help_panel'>
-    <img id='panel_icon' src='keybd_open.png'>
-<p class='legend'>Hot-keys on this page</p>
-    <div>
-<p class='keyhelp'>
-        <span class='key'>r</span>
-        <span class='key'>m</span>
-        <span class='key'>x</span>
-        <span class='key'>p</span> &nbsp; toggle line displays
-    </p>
-<p class='keyhelp'>
-        <span class='key'>j</span>
-        <span class='key'>k</span> &nbsp; next/prev highlighted chunk
-    </p>
-<p class='keyhelp'>
-        <span class='key'>0</span> &nbsp; (zero) top of page
-    </p>
-<p class='keyhelp'>
-        <span class='key'>1</span> &nbsp; (one) first highlighted chunk
-    </p>
-    </div>
-</div>
-
-<div id='source'>
-    <table cellspacing='0' cellpadding='0'>
-        <tr>
-            <td class='linenos' valign='top'>
-<p id='n1' class='pln'><a href='#n1'>1</a></p>
-<p id='n2' class='stm run hide_run'><a href='#n2'>2</a></p>
-<p id='n3' class='pln'><a href='#n3'>3</a></p>
-<p id='n4' class='stm run hide_run'><a href='#n4'>4</a></p>
-<p id='n5' class='pln'><a href='#n5'>5</a></p>
-<p id='n6' class='stm run hide_run'><a href='#n6'>6</a></p>
-<p id='n7' class='stm mis'><a href='#n7'>7</a></p>
-<p id='n8' class='stm mis'><a href='#n8'>8</a></p>
-<p id='n9' class='pln'><a href='#n9'>9</a></p>
-<p id='n10' class='stm run hide_run'><a href='#n10'>10</a></p>
-<p id='n11' class='stm run hide_run'><a href='#n11'>11</a></p>
-                
-            </td>
-            <td class='text' valign='top'>
-<p id='t1' class='pln'><span class='com'># A python source file in utf-8, with BOM</span><span class='strut'>&nbsp;</span></p>
-<p id='t2' class='stm run hide_run'><span class='nam'>math</span> <span class='op'>=</span> <span class='str'>&quot;3&#215;4 = 12, &#247;2 = 6&#177;0&quot;</span><span class='strut'>&nbsp;</span></p>
-<p id='t3' class='pln'><span class='strut'>&nbsp;</span></p>
-<p id='t4' class='stm run hide_run'><span class='key'>import</span> <span class='nam'>sys</span><span class='strut'>&nbsp;</span></p>
-<p id='t5' class='pln'><span class='strut'>&nbsp;</span></p>
-<p id='t6' class='stm run hide_run'><span class='key'>if</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>version_info</span> <span class='op'>&gt;=</span> <span class='op'>(</span><span class='num'>3</span><span class='op'>,</span> <span class='num'>0</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
-<p id='t7' class='stm mis'>&nbsp; &nbsp; <span class='key'>assert</span> <span class='nam'>len</span><span class='op'>(</span><span class='nam'>math</span><span class='op'>)</span> <span class='op'>==</span> <span class='num'>18</span><span class='strut'>&nbsp;</span></p>
-<p id='t8' class='stm mis'>&nbsp; &nbsp; <span class='key'>assert</span> <span class='nam'>len</span><span class='op'>(</span><span class='nam'>math</span><span class='op'>.</span><span class='nam'>encode</span><span class='op'>(</span><span class='str'>&#39;utf-8&#39;</span><span class='op'>)</span><span class='op'>)</span> <span class='op'>==</span> <span class='num'>21</span><span class='strut'>&nbsp;</span></p>
-<p id='t9' class='pln'><span class='key'>else</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
-<p id='t10' class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>assert</span> <span class='nam'>len</span><span class='op'>(</span><span class='nam'>math</span><span class='op'>)</span> <span class='op'>==</span> <span class='num'>21</span><span class='strut'>&nbsp;</span></p>
-<p id='t11' class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>assert</span> <span class='nam'>len</span><span class='op'>(</span><span class='nam'>math</span><span class='op'>.</span><span class='nam'>decode</span><span class='op'>(</span><span class='str'>&#39;utf-8&#39;</span><span class='op'>)</span><span class='op'>)</span> <span class='op'>==</span> <span class='num'>18</span><span class='strut'>&nbsp;</span></p>
-                
-            </td>
-        </tr>
-    </table>
-</div>
-
-<div id='footer'>
-    <div class='content'>
-        <p>
-            <a class='nav' href='index.html'>&#xab; index</a> &nbsp; &nbsp; <a class='nav' href='http://nedbatchelder.com/code/coverage'>coverage.py v3.5.2</a>
-        </p>
-    </div>
-</div>
-
-</body>
-</html>

test/farm/html/gold_bom/index.html

-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-    <meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
-    <title>Coverage report</title>
-    <link rel='stylesheet' href='style.css' type='text/css'>
-    
-    <script type='text/javascript' src='jquery-1.4.3.min.js'></script>
-    <script type='text/javascript' src='jquery.tablesorter.min.js'></script>
-    <script type='text/javascript' src='jquery.hotkeys.js'></script>
-    <script type='text/javascript' src='coverage_html.js'></script>
-    <script type='text/javascript' charset='utf-8'>
-        jQuery(document).ready(coverage.index_ready);
-    </script>
-</head>
-<body id='indexfile'>
-
-<div id='header'>
-    <div class='content'>
-        <h1>Coverage report:
-            <span class='pc_cov'>71%</span>
-        </h1>
-        <img id='keyboard_icon' src='keybd_closed.png'>
-    </div>
-</div>
-
-<div class='help_panel'>
-    <img id='panel_icon' src='keybd_open.png'>
-    <p class='legend'>Hot-keys on this page</p>
-    <div>
-    <p class='keyhelp'>
-        <span class='key'>n</span>
-        <span class='key'>s</span>
-        <span class='key'>m</span>
-        <span class='key'>x</span>
-        
-        <span class='key'>c</span> &nbsp; change column sorting
-    </p>
-    </div>
-</div>
-
-<div id='index'>
-    <table class='index'>
-        <thead>
-            
-            <tr class='tablehead' title='Click to sort'>
-                <th class='name left headerSortDown shortkey_n'>Module</th>
-                <th class='shortkey_s'>statements</th>
-                <th class='shortkey_m'>missing</th>
-                <th class='shortkey_x'>excluded</th>
-                
-                <th class='right shortkey_c'>coverage</th>
-            </tr>
-        </thead>
-        
-        <tfoot>
-            <tr class='total'>
-                <td class='name left'>Total</td>
-                <td>7</td>
-                <td>2</td>
-                <td>0</td>
-                
-                <td class='right'>71%</td>
-            </tr>
-        </tfoot>
-        <tbody>
-            
-            <tr class='file'>
-                <td class='name left'><a href='bom.html'>bom</a></td>
-                <td>7</td>
-                <td>2</td>
-                <td>0</td>
-                
-                <td class='right'>71%</td>
-            </tr>
-            
-        </tbody>
-    </table>
-</div>
-
-<div id='footer'>
-    <div class='content'>
-        <p>
-            <a class='nav' href='http://nedbatchelder.com/code/coverage'>coverage.py v3.5.2</a>
-        </p>
-    </div>
-</div>
-
-</body>
-</html>

test/farm/html/gold_isolatin1/index.html

-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-    <meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
-    <title>Coverage report</title>
-    <link rel='stylesheet' href='style.css' type='text/css'>
-    <script type='text/javascript' src='jquery-1.4.3.min.js'></script>
-    <script type='text/javascript' src='jquery.tablesorter.min.js'></script>
-    <script type='text/javascript' src='jquery.hotkeys.js'></script>
-    <script type='text/javascript' src='coverage_html.js'></script>
-    <script type='text/javascript' charset='utf-8'>
-        jQuery(document).ready(coverage.index_ready);
-    </script>
-</head>
-<body id='indexfile'>
-
-<div id='header'>
-    <div class='content'>
-        <h1>Coverage report:
-            <span class='pc_cov'>100%</span>
-        </h1>
-        <img id='keyboard_icon' src='keybd_closed.png'>
-    </div>
-</div>
-
-<div class='help_panel'>
-    <img id='panel_icon' src='keybd_open.png'>
-    <p class='legend'>Hot-keys on this page</p>
-    <div>
-    <p class='keyhelp'>
-        <span class='key'>n</span>
-        <span class='key'>s</span>
-        <span class='key'>m</span>
-        <span class='key'>x</span>
-        
-        <span class='key'>c</span> &nbsp; change column sorting
-    </p>
-    </div>
-</div>
-
-<div id='index'>
-    <table class='index'>
-        <thead>
-            
-            <tr class='tablehead' title='Click to sort'>
-                <th class='name left headerSortDown shortkey_n'>Module</th>
-                <th class='shortkey_s'>statements</th>
-                <th class='shortkey_m'>missing</th>
-                <th class='shortkey_x'>excluded</th>
-                
-                <th class='right shortkey_c'>coverage</th>
-            </tr>
-        </thead>
-        
-        <tfoot>
-            <tr class='total'>
-                <td class='name left'>Total</td>
-                <td>2</td>
-                <td>0</td>
-                <td>0</td>
-                
-                <td class='right'>100%</td>
-            </tr>
-        </tfoot>
-        <tbody>
-            
-            <tr class='file'>
-                <td class='name left'><a href='isolatin1.html'>isolatin1</a></td>
-                <td>2</td>
-                <td>0</td>
-                <td>0</td>
-                
-                <td class='right'>100%</td>
-            </tr>
-            
-        </tbody>
-    </table>
-</div>
-
-<div id='footer'>
-    <div class='content'>
-        <p>
-            <a class='nav' href='http://nedbatchelder.com/code/coverage/3.5.2b1'>coverage.py v3.5.2b1</a>
-        </p>
-    </div>
-</div>
-
-</body>
-</html>

test/farm/html/gold_isolatin1/isolatin1.html

-<!doctype html PUBLIC "-//W3C//DTD html 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-    <meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
-    
-    
-    <meta http-equiv='X-UA-Compatible' content='IE=emulateIE7' />
-    <title>Coverage for isolatin1: 100%</title>
-    <link rel='stylesheet' href='style.css' type='text/css'>
-    <script type='text/javascript' src='jquery-1.4.3.min.js'></script>
-    <script type='text/javascript' src='jquery.hotkeys.js'></script>
-    <script type='text/javascript' src='jquery.isonscreen.js'></script>
-    <script type='text/javascript' src='coverage_html.js'></script>
-    <script type='text/javascript' charset='utf-8'>
-        jQuery(document).ready(coverage.pyfile_ready);
-    </script>
-</head>
-<body id='pyfile'>
-
-<div id='header'>
-    <div class='content'>
-        <h1>Coverage for <b>isolatin1</b> :
-            <span class='pc_cov'>100%</span>
-        </h1>
-        <img id='keyboard_icon' src='keybd_closed.png'>
-        <h2 class='stats'>
-            2 statements
-            <span class='run hide_run shortkey_r' onclick='coverage.toggle_lines(this, "run")'>2 run</span>
-            <span class='mis shortkey_m' onclick='coverage.toggle_lines(this, "mis")'>0 missing</span>
-            <span class='exc shortkey_x' onclick='coverage.toggle_lines(this, "exc")'>0 excluded</span>
-            
-        </h2>
-    </div>
-</div>
-
-<div class='help_panel'>
-    <img id='panel_icon' src='keybd_open.png'>
-<p class='legend'>Hot-keys on this page</p>
-    <div>
-<p class='keyhelp'>
-        <span class='key'>r</span>
-        <span class='key'>m</span>
-        <span class='key'>x</span>
-        <span class='key'>p</span> &nbsp; toggle line displays
-    </p>
-<p class='keyhelp'>
-        <span class='key'>j</span>
-        <span class='key'>k</span> &nbsp; next/prev highlighted chunk
-    </p>
-<p class='keyhelp'>
-        <span class='key'>0</span> &nbsp; (zero) top of page
-    </p>
-<p class='keyhelp'>