Cython has moved to github.

cython-devel

view tests/run/c_type_methods_T236.pyx @ 2716:609f2037a6b6

test for ticket 236
author Stefan Behnel <scoder@users.berlios.de>
date Thu Dec 03 13:21:00 2009 +0100 (2 years ago)
parents
children 46cd8ba12f2d
line source
2 __doc__ = ''
4 import sys
5 if sys.version_info >= (2,6):
6 __doc__ = '''
7 >>> float_is_integer(1.0)
8 True
9 >>> float_is_integer(1.1)
10 False
11 '''
12 if sys.version_info >= (3,1):
13 __doc__ = '''
14 >>> int_bit_length(1) == (1).bit_length()
15 True
16 >>> int_bit_length(1234) == (1234).bit_length()
17 True
18 '''
20 def float_is_integer(float f):
21 # requires Python 2.6+
22 return f.is_integer()
24 def int_bit_length(int i):
25 # requires Python 3.x
26 return i.bit_length()
29 def float__add__(float f):
30 """
31 >>> float__add__(5.0)
32 7.0
33 """
34 return f.__add__(2)
36 def int__add__(int i):
37 """
38 >>> int__add__(5)
39 7
40 """
41 return i.__add__(2)