Skip to content

ternary ifs not taken into account by branch coverage #509

Open
@nedbat

Description

@nedbat

Originally reported by Antony Lee (Bitbucket: anntzer, GitHub: anntzer)


coverage 4.1, python 3.5.2, arch linux

test.py

cond = True

if cond:
    x = 1
else:
    x = 2

x = 1 if cond else 2
x = cond and 1 or 2

Getting branch coverage for this file shows partial coverage of the first if cond:, but not of the ternary (inline) if cond, or of the short-circuiting binary operators.


Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions