@@ -19,87 +19,96 @@ def assertEqual(x, y):
1919 print ("" )
2020 print ("typecode '%s'" % (typ ,))
2121 if typ == 'u' :
22- # FIXME(sbinet): implement
23- print (" SKIP: NotImplemented" )
24- continue
22+ arr = array .array (typ , "?世界!" )
2523 if typ in "bhilqfd" :
2624 arr = array .array (typ , [- 1 , - 2 , - 3 , - 4 ])
2725 if typ in "BHILQ" :
2826 arr = array .array (typ , [+ 1 , + 2 , + 3 , + 4 ])
29- print (" array: %s" % (repr (arr ),))
27+ print (" array: %s ## repr" % (repr (arr ),))
28+ print (" array: %s ## str" % (str (arr ),))
3029 print (" itemsize: %s" % (arr .itemsize ,))
3130 print (" typecode: %s" % (arr .typecode ,))
3231 print (" len: %s" % (len (arr ),))
3332 print (" arr[0]: %s" % (arr [0 ],))
3433 print (" arr[-1]: %s" % (arr [- 1 ],))
3534 try :
3635 arr [- 10 ]
37- print (" ERROR : expected an exception" )
36+ print (" ERROR1 : expected an exception" )
3837 except :
3938 print (" caught an exception [ok]" )
4039
4140 try :
4241 arr [10 ]
43- print (" ERROR : expected an exception" )
42+ print (" ERROR2 : expected an exception" )
4443 except :
4544 print (" caught an exception [ok]" )
4645 arr [- 2 ] = 33
4746 print (" arr[-2]: %s" % (arr [- 2 ],))
4847
4948 try :
5049 arr [- 10 ] = 2
51- print (" ERROR : expected an exception" )
50+ print (" ERROR3 : expected an exception" )
5251 except :
5352 print (" caught an exception [ok]" )
5453
5554 if typ in "bhilqfd" :
5655 arr .extend ([- 5 ,- 6 ])
5756 if typ in "BHILQ" :
5857 arr .extend ([5 ,6 ])
58+ if typ == 'u' :
59+ arr .extend ("he" )
5960 print (" array: %s" % (repr (arr ),))
6061 print (" len: %s" % (len (arr ),))
6162
6263 if typ in "bhilqfd" :
6364 arr .append (- 7 )
6465 if typ in "BHILQ" :
6566 arr .append (7 )
67+ if typ == 'u' :
68+ arr .append ("l" )
6669 print (" array: %s" % (repr (arr ),))
6770 print (" len: %s" % (len (arr ),))
6871
6972 try :
7073 arr .append ()
71- print (" ERROR : expected an exception" )
74+ print (" ERROR4 : expected an exception" )
7275 except :
7376 print (" caught an exception [ok]" )
7477 try :
7578 arr .append ([])
76- print (" ERROR : expected an exception" )
79+ print (" ERROR5 : expected an exception" )
7780 except :
7881 print (" caught an exception [ok]" )
7982 try :
8083 arr .append (1 , 2 )
81- print (" ERROR : expected an exception" )
84+ print (" ERROR6 : expected an exception" )
8285 except :
8386 print (" caught an exception [ok]" )
8487 try :
8588 arr .append (None )
86- print (" ERROR : expected an exception" )
89+ print (" ERROR7 : expected an exception" )
8790 except :
8891 print (" caught an exception [ok]" )
8992
9093 try :
9194 arr .extend ()
92- print (" ERROR : expected an exception" )
95+ print (" ERROR8 : expected an exception" )
9396 except :
9497 print (" caught an exception [ok]" )
9598 try :
9699 arr .extend (None )
97- print (" ERROR : expected an exception" )
100+ print (" ERROR9 : expected an exception" )
98101 except :
99102 print (" caught an exception [ok]" )
100103 try :
101104 arr .extend ([1 ,None ])
102- print (" ERROR: expected an exception" )
105+ print (" ERROR10: expected an exception" )
106+ except :
107+ print (" caught an exception [ok]" )
108+
109+ try :
110+ arr [0 ] = object ()
111+ print (" ERROR11: expected an exception" )
103112 except :
104113 print (" caught an exception [ok]" )
105114 pass
@@ -108,55 +117,48 @@ def assertEqual(x, y):
108117print ("## testing array.array(...)" )
109118try :
110119 arr = array .array ()
111- print ("ERROR : expected an exception" )
120+ print ("ERROR1 : expected an exception" )
112121except :
113122 print ("caught an exception [ok]" )
114123
115124try :
116125 arr = array .array (b"d" )
117- print ("ERROR : expected an exception" )
126+ print ("ERROR2 : expected an exception" )
118127except :
119128 print ("caught an exception [ok]" )
120129
121130try :
122131 arr = array .array ("?" )
123- print ("ERROR : expected an exception" )
132+ print ("ERROR3 : expected an exception" )
124133except :
125134 print ("caught an exception [ok]" )
126135
127136try :
128137 arr = array .array ("dd" )
129- print ("ERROR : expected an exception" )
138+ print ("ERROR4 : expected an exception" )
130139except :
131140 print ("caught an exception [ok]" )
132141
133142try :
134143 arr = array .array ("d" , initializer = [1 ,2 ])
135- print ("ERROR : expected an exception" )
144+ print ("ERROR5 : expected an exception" )
136145except :
137146 print ("caught an exception [ok]" )
138147
139148try :
140149 arr = array .array ("d" , [1 ], [])
141- print ("ERROR : expected an exception" )
150+ print ("ERROR6 : expected an exception" )
142151except :
143152 print ("caught an exception [ok]" )
144153
145154try :
146155 arr = array .array ("d" , 1 )
147- print ("ERROR : expected an exception" )
156+ print ("ERROR7 : expected an exception" )
148157except :
149158 print ("caught an exception [ok]" )
150159
151160try :
152161 arr = array .array ("d" , ["a" ,"b" ])
153- print ("ERROR: expected an exception" )
154- except :
155- print ("caught an exception [ok]" )
156-
157- try :
158- ## FIXME(sbinet): implement it at some point.
159- arr = array .array ("u" )
160- print ("ERROR: expected an exception" )
162+ print ("ERROR8: expected an exception" )
161163except :
162164 print ("caught an exception [ok]" )
0 commit comments