diff options
-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.""" |