summaryrefslogtreecommitdiff
path: root/test/farm/html/src/b.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2011-07-04 13:53:18 -0400
committerNed Batchelder <ned@nedbatchelder.com>2011-07-04 13:53:18 -0400
commit0f1b0d30e306ad35b1e29912e0613e9bf2618c47 (patch)
treea42e6bab3f2394b55f40d1f8439cbc734addf8c6 /test/farm/html/src/b.py
parent0b05ae076815f9239019e04778d4d481c8ae1ac3 (diff)
downloadpython-coveragepy-0f1b0d30e306ad35b1e29912e0613e9bf2618c47.tar.gz
for-else constructs are handled properly, avoiding bogus partial branch warnings. Fixes issue #122. Bonus irony: this also makes while 1 loops automatically understood better too.
Diffstat (limited to 'test/farm/html/src/b.py')
-rw-r--r--test/farm/html/src/b.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/test/farm/html/src/b.py b/test/farm/html/src/b.py
index dffdd50..3bf73a9 100644
--- a/test/farm/html/src/b.py
+++ b/test/farm/html/src/b.py
@@ -16,13 +16,14 @@ def two(x):
two(1)
-def three_way():
- # for-else can be a three-way branch.
- for i in range(10):
- if i == 3:
- break
- else:
- return 23
- return 17
+def three():
+ try:
+ # This if has two branches, *neither* one taken.
+ if name_error_this_variable_doesnt_exist:
+ a = 1
+ else:
+ a = 2
+ except:
+ pass
-three_way()
+three()