Remove trailing whitespace.
[cython.git] / tests / run / if.pyx
index 87123ae08f9184c22d51ce74d40a5b484aba9caa..f1c3d5ab89eeff808b6b17769ab22e033a575b45 100644 (file)
@@ -1,34 +1,12 @@
-__doc__ = u"""
+def f(a, b):
+    """
     >>> f(0,0)
     0
     >>> f(1,2)
     2
     >>> f(1,-1)
     1
-
-    >>> g(1,2)
-    1
-    >>> g(0,2)
-    2
-    >>> g(0,0)
-    0
-
-    >>> h(1,2)
-    1
-    >>> h(0,2)
-    2
-    >>> h(0,0)
-    3
-
-    >>> i(1,2)
-    1
-    >>> i(2,2)
-    2
-    >>> i(2,1)
-    0
-"""
-
-def f(a, b):
+    """
     x = 0
     if a:
         x = 1
@@ -37,14 +15,30 @@ def f(a, b):
     return x
 
 def g(a, b):
+    """
+    >>> g(1,2)
+    1
+    >>> g(0,2)
+    2
+    >>> g(0,0)
+    0
+    """
     x = 0
     if a:
         x = 1
     elif b:
         x = 2
     return x
-    
+
 def h(a, b):
+    """
+    >>> h(1,2)
+    1
+    >>> h(0,2)
+    2
+    >>> h(0,0)
+    3
+    """
     x = 0
     if a:
         x = 1
@@ -54,10 +48,23 @@ def h(a, b):
         x = 3
     return x
 
+try:
+    import __builtin__  as builtins
+except ImportError:
+    import builtins
+
 def i(a, b):
+    """
+    >>> i(1,2)
+    1
+    >>> i(2,2)
+    2
+    >>> i(2,1)
+    0
+    """
     x = 0
-    if str(a).upper() == u"1":
+    if builtins.str(a).upper() == u"1":
         x = 1
-    if str(a+b).lower() not in (u"1", u"3"):
+    if builtins.str(a+b).lower() not in (u"1", u"3"):
         x = 2
     return x