add out of bounds checks on list and tuple access
[pythonc.git] / tests / builtins.py
blob67c25f4bd250eaa2a4163f4ae139f769063eb44f
1 for x in [bool, dict, enumerate, int, isinstance, len, list, open, ord, print, range, repr, reversed, set, sorted, str, tuple, zip]:
2 print(x)
4 for x in [bool, dict, int, list, set, str, tuple]:
5 print(x())
7 for x in [0, 1]:
8 print(bool(x))
10 for x in [range(5)]:
11 print(list(enumerate(x)))
13 for x in [0, 1, False, True, '0', '1', '10', '15', '-123', '+714']:
14 print(int(x))
16 for x in [('10', 16), ('ff', 16), ('-abc', 36)]:
17 print(int(*x))
19 for x in ['', [], {}, set(), 'a', [1], {'b'}, {1: 2}]:
20 print(len(x))
22 for x in [range(5), {1, 2, 3}, [1, 'c'], '', 'a', 'abc']:
23 print(list(x))
25 for x in ['a', ' ', '+']:
26 print(ord(x))
28 for x in [0, 1, 5, 10]:
29 print(range(x))
30 print(list(range(x)))
32 for x in [0, 1, [], {}, set(), '', 'a', '\n', '\r', '\t', '\\', '"', '"\'', '\'"', "'", (), (1,), (1, 2)]:
33 print(repr(x))
35 for x in [[], [1], [1, 2, 3], (1, 2, 3)]:
36 print(list(reversed(x)))
38 for x in [[1], 'abc']:
39 print(set(x))
41 for x in [[5, 3, 1], (1, 3, 2), {10, 5, 0}]:
42 print(sorted(x))
44 for x in [[], range(1), range(5)]:
45 print(tuple(x))
47 for x in [0, False, True, None, 'a', []]:
48 print(str(x))
50 print(list(zip([1, 2], [3, 4])))
51 print(list(zip([1, 2, 3], [4, 5])))
52 print(list(zip([1, 2,], [3, 4, 5])))
54 for x in [[], ['a'], ['a', 'b', 'c'], ('x', 'y', 'z')]:
55 print(','.join(x))
56 for x in ['', 'a', ':', 'a:', 'a:b', 'a:b:c']:
57 print(x.split(':'))