Cython has moved to github.
cython-devel
view tests/run/flatin.pyx @ 1622:4f0327bdebc9
test for temp allocation bug in call
| author | Robert Bradshaw <robertwb@math.washington.edu> |
|---|---|
| date | Sat Jan 17 01:25:34 2009 -0800 (3 years ago) |
| parents | d0f4fc049d46 |
| children | 82d312a9f1fc |
line source
1 __doc__ = u"""
2 >>> test_in('ABC')
3 1
4 >>> test_in('abc')
5 2
6 >>> test_in('X')
7 3
8 >>> test_in('XYZ')
9 4
10 >>> test_in('ABCXYZ')
11 5
12 >>> test_in('')
13 5
15 >>> test_not_in('abc')
16 1
17 >>> test_not_in('CDE')
18 2
19 >>> test_not_in('CDEF')
20 3
21 >>> test_not_in('BCD')
22 4
23 """
25 def test_in(s):
26 if s in (u'ABC', u'BCD'):
27 return 1
28 elif s.upper() in (u'ABC', u'BCD'):
29 return 2
30 elif len(s) in (1,2):
31 return 3
32 elif len(s) in (3,4):
33 return 4
34 else:
35 return 5
37 def test_not_in(s):
38 if s not in (u'ABC', u'BCD', u'CDE', u'CDEF'):
39 return 1
40 elif s.upper() not in (u'ABC', u'BCD', u'CDEF'):
41 return 2
42 elif len(s) not in [3]:
43 return 3
44 elif len(s) not in [1,2]:
45 return 4
46 else:
47 return 5
