1__doc__ = u""" 2 >>> test_str(1) 3 'b' 4 5 >>> test_unicode_ascii(2) 6 u'c' 7 >>> test_unicode(2) == u'\u00e4' 8 True 9 10 >>> test_int_list(2) 11 3 12 >>> test_str_list(1) 13 'bcd' 14 15 >>> test_int_tuple(2) 16 3 17 >>> test_str_tuple(0) 18 'a' 19 >>> test_mix_tuple(1) 20 'abc' 21 >>> test_mix_tuple(0) 22 1 23""" 24 25import sys 26IS_PY3 = sys.version_info[0] >= 3 27if IS_PY3: 28 __doc__ = __doc__.replace(u" u'", u" '") 29else: 30 __doc__ = __doc__.replace(u" b'", u" '") 31 32def test_str(n): 33 return "abcd"[n] 34 35def test_unicode_ascii(n): 36 return u"abcd"[n] 37 38def test_unicode(n): 39 return u"\u00fc\u00f6\u00e4"[n] 40 41def test_int_list(n): 42 return [1,2,3,4][n] 43 44def test_str_list(n): 45 return ["a","bcd","efg","xyz"][n] 46 47def test_int_tuple(n): 48 return (1,2,3,4)[n] 49 50def test_str_tuple(n): 51 return ("a","bcd","efg","xyz")[n] 52 53def test_mix_tuple(n): 54 return (1, "abc", u"\u00fc", 1.1)[n] 55