summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES.rst7
-rw-r--r--coverage/parser.py5
-rw-r--r--tests/test_coverage.py2
-rw-r--r--tests/test_parser.py6
4 files changed, 12 insertions, 8 deletions
diff --git a/CHANGES.rst b/CHANGES.rst
index 6f78f477..70d48110 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -6,6 +6,13 @@ Change history for Coverage.py
==============================
+Unreleased
+----------
+
+- In beta 1, class docstrings were considered executable. Now they no longer
+ are.
+
+
Version 4.1b1 --- 2016-01-10
----------------------------
diff --git a/coverage/parser.py b/coverage/parser.py
index 4a7bab54..f0bfe614 100644
--- a/coverage/parser.py
+++ b/coverage/parser.py
@@ -125,7 +125,6 @@ class PythonParser(object):
excluding = False
excluding_decorators = False
prev_toktype = token.INDENT
- last_name = None
first_line = None
empty = True
first_on_line = True
@@ -147,7 +146,6 @@ class PythonParser(object):
# we need to exclude them. The simplest way is to note the
# lines with the 'class' keyword.
self.raw_classdefs.add(slineno)
- last_name = ttext
elif toktype == token.OP:
if ttext == ':':
should_exclude = (elineno in self.raw_excluded) or excluding_decorators
@@ -170,8 +168,7 @@ class PythonParser(object):
# (a trick from trace.py in the stdlib.) This works for
# 99.9999% of cases. For the rest (!) see:
# http://stackoverflow.com/questions/1769332/x/1769794#1769794
- if last_name == 'def':
- self.raw_docstrings.update(range(slineno, elineno+1))
+ self.raw_docstrings.update(range(slineno, elineno+1))
elif toktype == token.NEWLINE:
if first_line is not None and elineno != first_line:
# We're at the end of a line, and we've ended on a
diff --git a/tests/test_coverage.py b/tests/test_coverage.py
index 1173e1e6..dd47707c 100644
--- a/tests/test_coverage.py
+++ b/tests/test_coverage.py
@@ -1140,7 +1140,7 @@ class CompoundStatementTest(CoverageTest):
x = theClass().foo()
assert x == 1
""",
- [2, 3, 6, 8, 10, 11, 13, 14], "",
+ [2, 6, 8, 10, 11, 13, 14], "",
arcz=".2 2D DE E-2 23 36 6A A-2 .8 8-6 .B B-A",
)
diff --git a/tests/test_parser.py b/tests/test_parser.py
index fe907117..470ea156 100644
--- a/tests/test_parser.py
+++ b/tests/test_parser.py
@@ -145,8 +145,8 @@ class PythonParserTest(CoverageTest):
def func(x, y=5):
return 6
- class Foo: # only this..
- '''9''' # ..and this are statements.
+ class Foo: # this is the only statement.
+ '''9'''
@foo # nocover
def __init__(self):
'''12'''
@@ -169,7 +169,7 @@ class PythonParserTest(CoverageTest):
parser.raw_statements,
set([3, 4, 5, 6, 8, 9, 10, 13, 15, 16, 17, 20, 22, 23, 25, 26])
)
- self.assertEqual(parser.statements, set([8, 9]))
+ self.assertEqual(parser.statements, set([8]))
def test_class_decorator_pragmas(self):
parser = self.parse_source("""\