it's impossible to get total branch coverage of a loop over a constant expression

Issue #383 resolved
Glyph created an issue
for x in (1, 2, 3):
    print(x)

Coverage will always think that this is missing branch coverage, although there is no actually possible branch that hasn't been covered; there is no case where (1, 2, 3) doesn't have values in it. I believe iteration over constants like this should be reported as complete.

Comments (2)

  1. Glyph reporter

    Oops! This bug report was filed in error.

    The problem I actually had is if you have:

    for x in (1, 2, lambda: 3):
     pass
    

    Since the lambda: 3 is never called, it is reported as missing coverage, which is accurate; I misread it as reporting the loop-exit coverage.

  2. Log in to comment