Skip to content

Mark partially evaluated if conditions are not covered #292

Open
@nedbat

Description

@nedbat

Originally reported by Marc Schlaich (Bitbucket: schlamar, GitHub: schlamar)


This is a follow up from my comment in #198.

Consider the case:

#!python

def test(a, b):
    if a or b:
        print 1

If you run this it counts as covered if either a or b is True. But I think for a fully covered test you should consider both cases (True, False) and (False, True) before it is actually correctly covered. b could be a complicated statement which is never checked in unit tests even if this line has code coverage. Even a bug would get 100% coverage:

#!python

def test(a, b):
    if a or failing_statement:
        print 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions