yield in loop confuses branch coverage

Issue #324 resolved
Ned Batchelder
repo owner created an issue
def gen(inp):
    for n in inp:
        yield (i * 2 for i in range(n))

list(gen([1,2,3]))

Running this with --branch gives strange results. "2 partial branches", but only line 3 is marked, and it's marked with "2 exit".

Comments (2)

  1. Mickie Betz

    I was able to reproduce the issue with the input above. Here's the report output:

    Name Stmts Miss Branch BrPart Cover Missing

    issue-324.py 4 0 4 2 75% 5->-5, 5->4

    The html output looks like:

    Screen Shot 2015-04-13 at 12.43.01 PM.png

  2. Log in to comment