You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-02 16:44:46 +08:00
Add: Tests: CONTINUE in else block in a for loop
This commit is contained in:
33
test/simple_source/bug27+/07_for_if_else-continue.py
Normal file
33
test/simple_source/bug27+/07_for_if_else-continue.py
Normal file
@@ -0,0 +1,33 @@
|
||||
# Issue #413 on 2.7
|
||||
# Bug in handling CONTINUE in else block of if-then-else in a for loop
|
||||
|
||||
"""This program is self-checking!"""
|
||||
def test1(a, r = None):
|
||||
for b in a:
|
||||
if b:
|
||||
r = b
|
||||
else:
|
||||
continue
|
||||
raise AssertionError("CONTINUE not followed")
|
||||
if b:
|
||||
pass
|
||||
return r
|
||||
|
||||
def test2(a, r = None):
|
||||
for b in a:
|
||||
if b:
|
||||
#pass # No payload
|
||||
continue
|
||||
raise AssertionError("CONTINUE not followed")
|
||||
else:
|
||||
continue
|
||||
raise AssertionError("CONTINUE not followed")
|
||||
if b:
|
||||
r = b
|
||||
raise AssertionError("CONTINUE not followed")
|
||||
return r
|
||||
|
||||
assert test1([True]) == True, "Incorrect flow"
|
||||
assert test2([True]) is None, "Incorrect flow"
|
||||
assert test1([False]) is None, "Incorrect flow"
|
||||
assert test2([False]) is None, "Incorrect flow"
|
Reference in New Issue
Block a user