Cython has moved to github.

cython-devel

view tests/run/literalslice.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 a3bb74eb2cff
children 24bd77ad030e
line source
1 __doc__ = u"""
2 >>> test_str(1)
3 b'b'
5 >>> test_unicode_ascii(2)
6 u'c'
7 >>> test_unicode(2) == u'\u00e4'
8 True
10 >>> test_int_list(2)
11 3
12 >>> test_str_list(1)
13 b'bcd'
15 >>> test_int_tuple(2)
16 3
17 >>> test_str_tuple(0)
18 b'a'
19 >>> test_mix_tuple(1)
20 b'abc'
21 >>> test_mix_tuple(0)
22 1
23 """
25 import sys
26 IS_PY3 = sys.version_info[0] >= 3
27 if IS_PY3:
28 __doc__ = __doc__.replace(u" u'", u" '")
29 else:
30 __doc__ = __doc__.replace(u" b'", u" '")
32 def test_str(n):
33 if IS_PY3:
34 return bytes(["abcd"[n]])
35 else:
36 return "abcd"[n]
38 def test_unicode_ascii(n):
39 return u"abcd"[n]
41 def test_unicode(n):
42 return u"\u00fc\u00f6\u00e4"[n]
44 def test_int_list(n):
45 return [1,2,3,4][n]
47 def test_str_list(n):
48 return ["a","bcd","efg","xyz"][n]
50 def test_int_tuple(n):
51 return (1,2,3,4)[n]
53 def test_str_tuple(n):
54 return ("a","bcd","efg","xyz")[n]
56 def test_mix_tuple(n):
57 return (1, "abc", u"\u00fc", 1.1)[n]