1 from test_support
import *
7 def __getitem__(self
, i
):
8 if i
>= 0 and i
< 3: return i
19 if a
<> 1 or b
<> 2 or c
<> 3:
26 if a
<> 4 or b
<> 5 or c
<> 6:
29 # unpack implied tuple
31 print 'unpack implied tuple'
33 if a
<> 7 or b
<> 8 or c
<> 9:
36 # unpack string... fun!
40 if a
<> 'o' or b
<> 'n' or c
<> 'e':
43 # unpack generic sequence
45 print 'unpack sequence'
47 if a
<> 0 or b
<> 1 or c
<> 2:
50 # now for some failures
52 # unpacking non-sequence
54 print 'unpack non-sequence'
62 # unpacking tuple of wrong size
64 print 'unpack tuple wrong size'
71 # unpacking list of wrong size
73 print 'unpack list wrong size'
81 # unpacking sequence too short
83 print 'unpack sequence too short'
91 # unpacking sequence too long
93 print 'unpack sequence too long'
101 # unpacking a sequence where the test for too long raises a different
103 BozoError
= 'BozoError'
106 def __getitem__(self
, i
):
115 # trigger code while not expecting an IndexError
117 print 'unpack sequence too long, wrong error'
119 a
, b
, c
, d
, e
= BadSeq()
124 # trigger code while expecting an IndexError
126 print 'unpack sequence too short, wrong error'