diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2017-10-05 08:35:06 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2017-10-05 08:35:06 -0400 |
commit | aa10347a154d57455a2ca869615f2c6f9d10fc4d (patch) | |
tree | fae043f4a121fdad4a792a99bf628ac623986b28 | |
parent | fcfea15a10dbe010a8fd8fcd7b8ac1c37ae19678 (diff) | |
download | python-coveragepy-git-aa10347a154d57455a2ca869615f2c6f9d10fc4d.tar.gz |
Add an explicit test for weird module docstring behavior.
-rw-r--r-- | CHANGES.rst | 4 | ||||
-rw-r--r-- | tests/test_coverage.py | 23 |
2 files changed, 26 insertions, 1 deletions
diff --git a/CHANGES.rst b/CHANGES.rst index 9556bf0e..bc44710f 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -8,7 +8,9 @@ Change history for Coverage.py Unreleased ---------- -(nothing yet) +- Support for Python 3.7. In some cases, class and module docstrings are no + longer counted in statement totals, which could slightly change your total + results. .. _changes_441: diff --git a/tests/test_coverage.py b/tests/test_coverage.py index fae85bc6..45abb2be 100644 --- a/tests/test_coverage.py +++ b/tests/test_coverage.py @@ -574,6 +574,29 @@ class SimpleStatementTest(CoverageTest): [2, 3] ) + def test_module_docstring(self): + self.check_coverage("""\ + '''I am a module docstring.''' + a = 2 + b = 3 + """, + [2, 3] + ) + if env.PYVERSION < (3, 7): + # Before 3.7, module docstrings were included in the lnotab table, + # unless they were the first line in the file? + lines = [2, 3, 4] + else: + lines = [3, 4] + self.check_coverage("""\ + # Start with a comment, because it changes the behavior(!?) + '''I am a module docstring.''' + a = 3 + b = 4 + """, + lines + ) + class CompoundStatementTest(CoverageTest): """Testing coverage of multi-line compound statements.""" |