Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yield in loop confuses branch coverage #324

Closed
nedbat opened this issue Aug 29, 2014 · 2 comments
Closed

yield in loop confuses branch coverage #324

nedbat opened this issue Aug 29, 2014 · 2 comments
Labels
branch bug Something isn't working

Comments

@nedbat
Copy link
Owner

nedbat commented Aug 29, 2014

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".


@nedbat
Copy link
Owner Author

nedbat commented Apr 13, 2015

Original comment by Mickie Betz (Bitbucket: mbetz08, GitHub: mbetz08)


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

@nedbat
Copy link
Owner Author

nedbat commented Apr 20, 2015

@nedbat nedbat closed this as completed Apr 20, 2015
@nedbat nedbat added major bug Something isn't working branch labels Jun 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
branch bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant