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 /tests/test_coverage.py | |
parent | fcfea15a10dbe010a8fd8fcd7b8ac1c37ae19678 (diff) | |
download | python-coveragepy-git-aa10347a154d57455a2ca869615f2c6f9d10fc4d.tar.gz |
Add an explicit test for weird module docstring behavior.
Diffstat (limited to 'tests/test_coverage.py')
-rw-r--r-- | tests/test_coverage.py | 23 |
1 files changed, 23 insertions, 0 deletions
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.""" |