8000 PEP 626: Docstring-only functions changed again · nedbat/coveragepy@5c3d094 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5c3d094

Browse files
committed
PEP 626: Docstring-only functions changed again
1 parent e3f8053 commit 5c3d094

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

coverage/env.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ class PYBEHAVIOR(object):
8282
# affect the outcome.
8383
actual_syspath0_dash_m = CPYTHON and (PYVERSION >= (3, 7, 0, 'beta', 3))
8484

85+
# 3.7 changed how functions with only docstrings are numbered.
86+
docstring_only_function = (not PYPY) and ((3, 7, 0, 'beta', 5) <= PYVERSION <= (3, 10))
87+
8588
# When a break/continue/return statement in a try block jumps to a finally
8689
# block, does the finally block do the break/continue/return (pre-3.8), or
8790
# does the finally jump back to the break/continue/return (3.8) to do the

tests/test_parser.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def bar(self):
214214
expected_arcs = set(arcz_to_arcs(".1 14 48 8. .2 2. -8A A-8"))
215215
expected_exits = {1: 1, 2: 1, 4: 1, 8: 1, 10: 1}
216216

217-
if (not env.PYPY) and (env.PYVERSION >= (3, 7, 0, 'beta', 5)):
217+
if env.PYBEHAVIOR.docstring_only_function:
218218
# 3.7 changed how functions with only docstrings are numbered.
219219
expected_arcs.update(set(arcz_to_arcs("-46 6-4")))
220220
expected_exits.update({6: 1})
@@ -394,6 +394,7 @@ def function():
394394
"line 16 didn't return from function 'function', "
395395
"because the return on line 12 wasn't executed"
396396
)
397+
397398
def test_missing_arc_descriptions_bug460(self):
398399
parser = self.parse_text(u"""\
399400
x = 1

0 commit comments

Comments
 (0)
0