diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2018-06-13 07:22:44 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2018-06-13 07:22:44 -0400 |
commit | 637851fcc659b92ad493c3edc87f9f2fc9b1c313 (patch) | |
tree | 710624a99a61c2a126f3b4549ff7fbb487074afa | |
parent | 1b94cffbbcf809bae8ecc338b498622be8d3a163 (diff) | |
download | python-coveragepy-git-637851fcc659b92ad493c3edc87f9f2fc9b1c313.tar.gz |
Adapt to a recent 3.7 change in how functions with only docstrings get line-numbered
-rw-r--r-- | tests/test_parser.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/test_parser.py b/tests/test_parser.py index 184825bf..034e9aa7 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -197,8 +197,14 @@ class PythonParserTest(CoverageTest): pass """) self.assertEqual(parser.statements, set([1, 2, 4, 8, 10])) - self.assertEqual(parser.arcs(), set(self.arcz_to_arcs(".1 14 48 8. .2 2. -8A A-8"))) - self.assertEqual(parser.exit_counts(), {1: 1, 2: 1, 4: 1, 8: 1, 10: 1}) + expected_arcs = set(self.arcz_to_arcs(".1 14 48 8. .2 2. -8A A-8")) + expected_exits = {1: 1, 2: 1, 4: 1, 8: 1, 10: 1} + if env.PYVERSION >= (3, 7, 0, 'beta', 5): + # 3.7 changed how functions with only docstrings were numbered. + expected_arcs.update(set(self.arcz_to_arcs("-46 6-4"))) + expected_exits.update({6: 1}) + self.assertEqual(parser.arcs(), expected_arcs) + self.assertEqual(parser.exit_counts(), expected_exits) class ParserMissingArcDescriptionTest(CoverageTest): |