Skip to content

Pragmas on continued long lines don't work #754

Closed
@nedbat

Description

@nedbat

(From https://stackoverflow.com/questions/54111889/coverage-pragma-no-branch-with-multiline-statement)

A pragma comment on the continuation lines of a multi-line if-statement won't have an effect:

For the python coverage package, a missing else can be ignored for the resulting coverage by using # pragma: no branch.

It seems, that this is not working when breaking a long if statement in multiple lines like this:

if this_is_a_verylong_boolean_expression == True and another_long_expression \
    and here_another_expression:  # pragma: no branch
    do_something()

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions