test for ticket 236
authorStefan Behnel <scoder@users.berlios.de>
Thu, 3 Dec 2009 12:21:00 +0000 (13:21 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Thu, 3 Dec 2009 12:21:00 +0000 (13:21 +0100)
tests/run/c_type_methods_T236.pyx [new file with mode: 0644]

diff --git a/tests/run/c_type_methods_T236.pyx b/tests/run/c_type_methods_T236.pyx
new file mode 100644 (file)
index 0000000..ed536b9
--- /dev/null
@@ -0,0 +1,41 @@
+
+__doc__ = ''
+
+import sys
+if sys.version_info >= (2,6):
+    __doc__ = '''
+>>> float_is_integer(1.0)
+True
+>>> float_is_integer(1.1)
+False
+'''
+if sys.version_info >= (3,1):
+    __doc__ = '''
+>>> int_bit_length(1) == (1).bit_length()
+True
+>>> int_bit_length(1234) == (1234).bit_length()
+True
+'''
+
+def float_is_integer(float f):
+    # requires Python 2.6+
+    return f.is_integer()
+
+def int_bit_length(int i):
+    # requires Python 3.x
+    return i.bit_length()
+
+
+def float__add__(float f):
+    """
+    >>> float__add__(5.0)
+    7.0
+    """
+    return f.__add__(2)
+
+def int__add__(int i):
+    """
+    >>> int__add__(5)
+    7
+    """
+    return i.__add__(2)