pass or continue in else branch considered missing

Issue #497 duplicate
Peter Inglesby created an issue

I would expect the following code to have 100% coverage, but it doesn't -- the continue line is marked as missing.

for n in [1, 2]:
    if n == 1:
        pass
    else:
        continue

The same happens if the continue is changed to pass. The contents of the if block is not important.

This may be a duplicate of #493 or #496.

I'm using coverage 4.1, and have reproduced with Pythons 3.5.1 and 2.7.10.

The contents of .coverage is:

!coverage.py: This is a private format, don't read it directly!{"lines": {"/Users/inglesp/coverage_demo.py": [1, 2, 3]}}

Comments (6)

  1. Peter Inglesby reporter

    I think the limitation should be documented. If it's not already (I can't find it), would you welcome a patch?

  2. Log in to comment