try fixing test failures in int_literals.pyx by removing dependency on Py2/3 specific...
authorStefan Behnel <stefan_ml@behnel.de>
Wed, 11 Dec 2013 18:02:23 +0000 (19:02 +0100)
committerStefan Behnel <stefan_ml@behnel.de>
Wed, 11 Dec 2013 18:02:23 +0000 (19:02 +0100)
tests/run/int_literals.pyx

index 74a4700..79b64ef 100644 (file)
@@ -1,27 +1,8 @@
-__doc__ = u"""
->>> c_longs()
-(1, 1L, -1, 18446744073709551615L)
->>> negative_c_longs()
-(-1, -9223285636854775809L)
->>> py_longs()
-(1, 1L, 100000000000000000000000000000000L, -100000000000000000000000000000000L)
-
->>> py_huge_calculated_long()
-1606938044258990275541962092341162602522202993782792835301376L
->>> py_huge_computation_small_result_neg()
-(-2535301200456458802993406410752L, -2535301200456458802993406410752L)
-"""
-
 cimport cython
 from cython cimport typeof
 
 import sys
 
-if sys.version_info[0] >= 3:
-    __doc__ = __doc__.replace(u'L', u'')
-elif sys.maxint > 2**31:
-    # sizeof(long) == sizeof(long long)
-    __doc__ = __doc__.replace("9223285636854775809L", "9223285636854775809")
 
 @cython.test_assert_path_exists(
     '//IntNode[@longness = "LL"]',
@@ -29,6 +10,10 @@ elif sys.maxint > 2**31:
     )
 @cython.test_fail_if_path_exists('//IntNode[@longness = ""]')
 def c_longs():
+    """
+    >>> c_longs() == (1, 1L, -1, 18446744073709551615L)  or  c_longs()
+    True
+    """
     cdef long a = 1L
     cdef unsigned long ua = 1UL
     cdef long long aa = 0xFFFFFFFFFFFFFFFFLL
@@ -41,16 +26,32 @@ def c_longs():
     )
 @cython.test_fail_if_path_exists('//IntNode[@longness = ""]')
 def negative_c_longs():
+    """
+    >>> negative_c_longs() == (-1, -9223285636854775809)  or  negative_c_longs()
+    True
+    """
     cdef long a = -1L
     cdef long long aa = -9223285636854775809LL
     return a, aa
 
 def py_longs():
+    """
+    >>> py_longs() == (
+    ...     1, 1, 100000000000000000000000000000000, -100000000000000000000000000000000
+    ...     )  or  py_longs()
+    True
+    """
     return 1, 1L, 100000000000000000000000000000000, -100000000000000000000000000000000
 
 @cython.test_fail_if_path_exists("//NumBinopNode", "//IntBinopNode")
 @cython.test_assert_path_exists("//ReturnStatNode/IntNode")
 def py_huge_calculated_long():
+    """
+    >>> py_huge_calculated_long() == (
+    ...     1606938044258990275541962092341162602522202993782792835301376
+    ...     )  or  py_huge_calculated_long()
+    True
+    """
     return 1 << 200
 
 @cython.test_fail_if_path_exists("//NumBinopNode", "//IntBinopNode")
@@ -65,6 +66,12 @@ def py_huge_computation_small_result():
 @cython.test_fail_if_path_exists("//NumBinopNode", "//IntBinopNode")
 #@cython.test_assert_path_exists("//ReturnStatNode/IntNode")
 def py_huge_computation_small_result_neg():
+    """
+    >>> py_huge_computation_small_result_neg() == (
+    ...    -2535301200456458802993406410752L, -2535301200456458802993406410752L
+    ...    )  or  py_huge_computation_small_result_neg()
+    True
+    """
     return -(2 ** 101), (-2) ** 101
 
 def large_literal():