1. Ned Batchelder
  2. coverage.py
Issue #148 duplicate

for/else not handled correctly in branch coverage

Wichert Akkerman
created an issue

I am testing a code snippet which looks like this: {{{

!python

for (key, value) in criteria.items(): if getattr(obj, key, None) != value: return None else: return None }}}

this always falsely reports a missing exit branch on the for-loop. Rewriting this to the version below which does not use a for/else construct remove this problem.

{{{

!python

for (key, value) in criteria.items(): if getattr(obj, key, None) != value: return None return None }}}

Comments (3)

  1. Log in to comment