Skip to content

Wrongly treat statement as uncovered #694

Closed
@whoiscc

Description

@whoiscc

Reproduction:

class A:
    def __init__(self, xs):
        self._xs = xs

    def __getitem__(self, x):
        return x in self._xs


a1 = A([10])
a2 = A(list(range(42)))

for i in range(42):
    for j in range(42):
        if not a1[i] or not a2[j]:
            continue

After running coverage run test.py and coverage report -m:

Name      Stmts   Miss  Cover   Missing
---------------------------------------
test.py      11      1    91%   15

And line 15 is the single continue statement. If I add a print('continue') above it, tons of "continue" will be printed, and coverage report correctly back to 100%.

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions