improved test case
authorStefan Behnel <scoder@users.berlios.de>
Sat, 23 Apr 2011 19:15:46 +0000 (21:15 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Sat, 23 Apr 2011 19:15:46 +0000 (21:15 +0200)
tests/run/trybreak.pyx

index 3db9c7ec2ea35f322e98e30c82135fb86069a065..2f603ba9ff476495aa0c1a2044108a022d524faf 100644 (file)
@@ -1,17 +1,38 @@
-__doc__ = u"""
->>> print(foo())
-a
-"""
-
 # Indirectly makes sure the cleanup happens correctly on breaking.
-def foo():
-    for x in "abc":
+
+def try_except_break():
+    """
+    >>> print(try_except_break())
+    a
+    """
+    for x in list("abc"):
         try:
             x()
         except:
             break
-    for x in "abc":
+    return x
+
+def try_break_except():
+    """
+    >>> print(try_break_except())
+    a
+    """
+    for x in list("abc"):
+        try:
+            break
+        except:
+            pass
+    return x
+
+def try_no_break_except_return():
+    """
+    >>> print(try_no_break_except_return())
+    a
+    """
+    for x in list("abc"):
         try:
             x()
+            break
         except:
             return x
+    return x