summaryrefslogtreecommitdiff
path: root/tests/run/type_slots_int_long_T287.pyx
blob: 7b66125b9d6eff96666a5f26672070edc24c8198 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# ticket: t287

__doc__ = u"""
>>> print( "%d" % Int() )
2
>>> print( "%d" % Long() )
3
>>> print( "%d" % IntLongA() )
2
>>> print( "%d" % IntLongB() )
2

"""


def getint(int i):
    """
    >>> getint( Int() )
    2
    >>> getint( Long() )
    3
    >>> getint( IntLongA() )
    2
    >>> getint( IntLongB() )
    2
    """
    return i

def getlong(long long i):
    """
    >>> getlong( Int() )
    2
    >>> getlong( Long() )
    3
    >>> getlong( IntLongA() )
    2
    >>> getlong( IntLongB() )
    2
    """
    return <int>i


cdef class Int:
   def __int__(self):
       return 2

cdef class Long:
   def __long__(self):
       return 3

cdef class IntLongA:
   def __int__(self):
       return 2
   def __long__(self):
       return 3

cdef class IntLongB:
   def __int__(self):
       return 2
   __long__ = __int__