for/else not handled correctly in branch coverage

Issue #148 duplicate
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. Ned Batchelder repo owner

    This has been fixed in 3.5.1b1. Can you test your code on that version, and confirm it for me?

  2. Wichert Akkerman reporter

    I can indeed confirm it. Looking at the changelog that also means this is a duplicate of issue 122, so I'll mark it as such.

    Duplicate of #122.

  3. Log in to comment