Skip to content

Condition statatement coverage #957

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

Closed
omry opened this issue Mar 13, 2020 · 1 comment
Closed

Condition statatement coverage #957

omry opened this issue Mar 13, 2020 · 1 comment
Labels
duplicate This issue or pull request already exists

Comments

@omry
Copy link

omry commented Mar 13, 2020

Consider:

def foo(c1, c2):
    if c1 or c2:
        print("yes")
    else:
        print("no")


foo(True, False)
foo(False, False)

This gives 100% coverage, even with branch prediction.

$ coverage run --branch 1.py && coverage report
yes
no
Name    Stmts   Miss Branch BrPart  Cover
-----------------------------------------
1.py        6      0      2      0   100%

However, the case where c2 is True is never tested.

Thoughts?

@nedbat
Copy link
Owner

nedbat commented Mar 15, 2020

This is a duplicate of #292.

@nedbat nedbat closed this as completed Mar 15, 2020
@nedbat nedbat added the duplicate This issue or pull request already exists label Mar 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants