diff --git a/test/bytecode_2.7_run/07_for_if_else-continue.pyc b/test/bytecode_2.7_run/07_for_if_else-continue.pyc index e4894c38..616fa031 100644 Binary files a/test/bytecode_2.7_run/07_for_if_else-continue.pyc and b/test/bytecode_2.7_run/07_for_if_else-continue.pyc differ diff --git a/test/simple_source/bug27+/07_for_if_else-continue.py b/test/simple_source/bug27+/07_for_if_else-continue.py index 3944232a..d1e421fe 100644 --- a/test/simple_source/bug27+/07_for_if_else-continue.py +++ b/test/simple_source/bug27+/07_for_if_else-continue.py @@ -1,15 +1,17 @@ # Issue #413 on 2.7 # Bug in handling CONTINUE in else block of if-then-else in a for loop +# Bug was "if" and "else" jump back to loop getting detected. +# RUNNABLE! """This program is self-checking!""" -def test1(a, r = None): +def test1(a, r = []): for b in a: if b: - r = b + r.append(3) else: + r.append(5) continue - raise AssertionError("CONTINUE not followed") - if b: + if r == []: pass return r @@ -27,7 +29,13 @@ def test2(a, r = None): raise AssertionError("CONTINUE not followed") return r -assert test1([True]) == True, "Incorrect flow" +assert test1([], []) == [], "For loop not taken" +assert test1([False], []) == [5], "if 'else' should have been taken" +assert test1([True], []) == [3], "if 'then' should have been taken" +assert test1([True, True], []) == [3, 3], "if should have been taken" +assert test1([True, False], []) == [3, 5], "if and then 'else' should have been taken" +assert test1([False, True], []) == [5, 3], "if else and then 'then' should have been taken" +assert test1([False, False], []) == [5, 5], "if else should have been taken twice" +assert test1([True, True], []) == [3, 3], "if 'then' should have been taken twice" assert test2([True]) is None, "Incorrect flow" -assert test1([False]) is None, "Incorrect flow" assert test2([False]) is None, "Incorrect flow"