PageRenderTime 66ms CodeModel.GetById 9ms app.highlight 52ms RepoModel.GetById 1ms app.codeStats 0ms

/IronPython_Main/Languages/IronPython/Tests/modules/io_related/_fileio_test.py

#
Python | 450 lines | 431 code | 0 blank | 19 comment | 0 complexity | 2cf95d49e7a1050c77a2800c0fd16e81 MD5 | raw file
  1#####################################################################################
  2#
  3#  Copyright (c) Microsoft Corporation. All rights reserved.
  4#
  5# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
  6# copy of the license can be found in the License.html file at the root of this distribution. If
  7# you cannot locate the  Apache License, Version 2.0, please send an email to
  8# ironpy@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
  9# by the terms of the Apache License, Version 2.0.
 10#
 11# You must not remove this notice, or any other, from this software.
 12#
 13#
 14#####################################################################################
 15'''
 16Tests for CPython's _fileio module.
 17'''
 18
 19#--IMPORTS---------------------------------------------------------------------
 20from iptest.assert_util import *
 21skiptest("silverlight")
 22
 23import sys, os
 24
 25if sys.winver == '2.6':
 26    import _fileio
 27    FileIO = _fileio._FileIO
 28else:
 29    from _io import FileIO
 30
 31#--GLOBALS---------------------------------------------------------------------
 32TEMP_READINTO_NAME = "_fileio__FileIO_readinto%d.tmp"
 33
 34#--HELPERS---------------------------------------------------------------------
 35def bytesio_helper():
 36    return (bytes(bytearray(b'')),
 37            bytes(bytearray(b'a')),
 38            bytes(bytearray(b'ab')),
 39            bytes(bytearray(b'abc')),
 40            bytes(bytearray(b'abcd')),
 41            bytes(bytearray(b'abcde')),
 42            bytes(bytearray(b'abcdef')),
 43            bytes(bytearray(b'abcdefg')),
 44            bytes(bytearray(b'abcdefgh')),
 45            bytes(bytearray(b'abcdefghi'))
 46            )
 47
 48def fileio_helper():
 49    bytes_io_list = bytesio_helper()
 50    file_io_list  = []
 51    for i in xrange(len(bytes_io_list)):
 52        f = FileIO(TEMP_READINTO_NAME % i, "w")
 53        f.write(bytes_io_list[i])
 54        f.close()
 55        file_io_list.append(FileIO(TEMP_READINTO_NAME % i, "r"))
 56    
 57    return file_io_list
 58
 59#--TEST CASES------------------------------------------------------------------
 60def test__FileIO___class__():
 61    '''
 62    TODO
 63    '''
 64    pass
 65
 66def test__FileIO___delattr__():
 67    '''
 68    TODO
 69    '''
 70    pass
 71
 72def test__FileIO___doc__():
 73    '''
 74    TODO
 75    '''
 76    pass
 77
 78def test__FileIO___format__():
 79    '''
 80    TODO
 81    '''
 82    pass
 83
 84def test__FileIO___getattribute__():
 85    '''
 86    TODO
 87    '''
 88    pass
 89
 90def test__FileIO___hash__():
 91    '''
 92    TODO
 93    '''
 94    pass
 95
 96def test__FileIO___init__():
 97    '''
 98    TODO
 99    '''
100    pass
101
102def test__FileIO___new__():
103    '''
104    TODO
105    '''
106    pass
107
108def test__FileIO___reduce__():
109    '''
110    TODO
111    '''
112    pass
113
114def test__FileIO___reduce_ex__():
115    '''
116    TODO
117    '''
118    pass
119
120def test__FileIO___repr__():
121    '''
122    TODO
123    '''
124    pass
125
126def test__FileIO___setattr__():
127    '''
128    TODO
129    '''
130    pass
131
132def test__FileIO___sizeof__():
133    '''
134    TODO
135    '''
136    pass
137
138def test__FileIO___str__():
139    '''
140    TODO
141    '''
142    pass
143
144def test__FileIO___subclasshook__():
145    '''
146    TODO
147    '''
148    pass
149
150def test__FileIO_close():
151    '''
152    TODO
153    '''
154    pass
155
156def test__FileIO_closed():
157    '''
158    TODO
159    '''
160    pass
161
162def test__FileIO_closefd():
163    '''
164    TODO
165    '''
166    pass
167
168def test__FileIO_fileno():
169    '''
170    TODO
171    '''
172    pass
173
174def test__FileIO_isatty():
175    '''
176    TODO
177    '''
178    pass
179
180def test__FileIO_mode():
181    '''
182    TODO
183    '''
184    pass
185
186def test__FileIO_read():
187    '''
188    TODO
189    '''
190    pass
191
192def test__FileIO_readable():
193    '''
194    TODO
195    '''
196    pass
197
198def test__FileIO_readall():
199    '''
200    TODO
201    '''
202    pass
203
204def test__FileIO_readinto():
205    '''
206    TODO
207    '''
208    pass
209
210def test__FileIO_seek():
211    '''
212    TODO
213    '''
214    pass
215
216def test__FileIO_seekable():
217    '''
218    TODO
219    '''
220    pass
221
222def test__FileIO_tell():
223    '''
224    TODO
225    '''
226    pass
227
228def test__FileIO_truncate():
229    '''
230    TODO
231    '''
232    pass
233
234def test__FileIO_writable():
235    '''
236    TODO
237    '''
238    pass
239
240def test__FileIO_write():
241    '''
242    TODO
243    '''
244    pass
245
246
247def test_coverage():
248    '''
249    Test holes as found by code coverage runs.  These need to be refactored and
250    moved to other functions throughout this module (TODO).
251    '''
252
253    #--FileIO.readinto(array.array(...))
254    import array
255    
256    readinto_cases = [
257                        [('c',),
258                         [[],[],[],[],[],[],[],[],[],[]],
259                         [0,0,0,0,0,0,0,0,0,0]],
260                        [('c',['z']),
261                         [['z'],['a'],['a'],['a'],['a'],['a'],['a'],['a'],['a'],['a']],
262                         [0,1,1,1,1,1,1,1,1,1]],
263                        [('c',['a','z']),
264                         [['a','z'],['a','z'],['a','b'],['a','b'],['a','b'],['a','b'],['a','b'],['a','b'],['a','b'],['a','b']],
265                         [0,1,2,2,2,2,2,2,2,2]],
266                        [('b',),
267                         [[],[],[],[],[],[],[],[],[],[]],
268                         [0,0,0,0,0,0,0,0,0,0]],
269                        [('b',[0]),
270                         [[0],[97],[97],[97],[97],[97],[97],[97],[97],[97]],
271                         [0,1,1,1,1,1,1,1,1,1]],
272                        [('b',[0,-1]),
273                         [[0,-1],[97,-1],[97,98],[97,98],[97,98],[97,98],[97,98],[97,98],[97,98],[97,98]],
274                         [0,1,2,2,2,2,2,2,2,2]],
275                        [('b',[0,1,2]),
276                         [[0,1,2],[97,1,2],[97,98,2],[97,98,99],[97,98,99],[97,98,99],[97,98,99],[97,98,99],[97,98,99],[97,98,99]],
277                         [0,1,2,3,3,3,3,3,3,3]],
278                        [('b',[0,1,2,3,4,5,6]),
279                         [[0,1,2,3,4,5,6],[97,1,2,3,4,5,6],[97,98,2,3,4,5,6],[97,98,99,3,4,5,6],[97,98,99,100,4,5,6],[97,98,99,100,101,5,6],[97,98,99,100,101,102,6],[97,98,99,100,101,102,103],[97,98,99,100,101,102,103],[97,98,99,100,101,102,103]],
280                         [0,1,2,3,4,5,6,7,7,7]],
281                        [('b',[0,1,2,3,4,5,6,7]),
282                         [[0,1,2,3,4,5,6,7],[97,1,2,3,4,5,6,7],[97,98,2,3,4,5,6,7],[97,98,99,3,4,5,6,7],[97,98,99,100,4,5,6,7],[97,98,99,100,101,5,6,7],[97,98,99,100,101,102,6,7],[97,98,99,100,101,102,103,7],[97,98,99,100,101,102,103,104],[97,98,99,100,101,102,103,104]],
283                         [0,1,2,3,4,5,6,7,8,8]],
284                        [('b',[0,1,2,3,4,5,6,7,8]),
285                         [[0,1,2,3,4,5,6,7,8],[97,1,2,3,4,5,6,7,8],[97,98,2,3,4,5,6,7,8],[97,98,99,3,4,5,6,7,8],[97,98,99,100,4,5,6,7,8],[97,98,99,100,101,5,6,7,8],[97,98,99,100,101,102,6,7,8],[97,98,99,100,101,102,103,7,8],[97,98,99,100,101,102,103,104,8],[97,98,99,100,101,102,103,104,105]],
286                         [0,1,2,3,4,5,6,7,8,9]],
287                        [('b',[0,1,2,3,4,5,6,7,8,9]),
288                         [[0,1,2,3,4,5,6,7,8,9],[97,1,2,3,4,5,6,7,8,9],[97,98,2,3,4,5,6,7,8,9],[97,98,99,3,4,5,6,7,8,9],[97,98,99,100,4,5,6,7,8,9],[97,98,99,100,101,5,6,7,8,9],[97,98,99,100,101,102,6,7,8,9],[97,98,99,100,101,102,103,7,8,9],[97,98,99,100,101,102,103,104,8,9],[97,98,99,100,101,102,103,104,105,9]],
289                         [0,1,2,3,4,5,6,7,8,9]],
290                        [('B',),
291                         [[],[],[],[],[],[],[],[],[],[]],
292                         [0,0,0,0,0,0,0,0,0,0]],
293                        [('B',[0,1]),
294                         [[0,1],[97,1],[97,98],[97,98],[97,98],[97,98],[97,98],[97,98],[97,98],[97,98]],
295                         [0,1,2,2,2,2,2,2,2,2]],
296                        [('u',),
297                         [[],[],[],[],[],[],[],[],[],[]],
298                         [0,0,0,0,0,0,0,0,0,0]],
299                        [('u',u''),
300                         [[],[],[],[],[],[],[],[],[],[]],
301                         [0,0,0,0,0,0,0,0,0,0]],
302                        [('h',),
303                         [[],[],[],[],[],[],[],[],[],[]],
304                         [0,0,0,0,0,0,0,0,0,0]],
305                        [('h',[1,2]),
306                         [[1,2],[97,2],[25185,2],[25185,99],[25185,25699],[25185,25699],[25185,25699],[25185,25699],[25185,25699],[25185,25699]],
307                         [0,1,2,3,4,4,4,4,4,4]],
308                        [('H',),
309                         [[],[],[],[],[],[],[],[],[],[]],
310                         [0,0,0,0,0,0,0,0,0,0]],
311                        [('H',[]),
312                         [[],[],[],[],[],[],[],[],[],[]],
313                         [0,0,0,0,0,0,0,0,0,0]],
314                        [('H',[49]),
315                         [[49],[97],[25185],[25185],[25185],[25185],[25185],[25185],[25185],[25185]],
316                         [0,1,2,2,2,2,2,2,2,2]],
317                        [('H',[2,3]),
318                         [[2,3],[97,3],[25185,3],[25185,99],[25185,25699],[25185,25699],[25185,25699],[25185,25699],[25185,25699],[25185,25699]],
319                         [0,1,2,3,4,4,4,4,4,4]],
320                        [('i',),
321                         [[],[],[],[],[],[],[],[],[],[]],
322                         [0,0,0,0,0,0,0,0,0,0]],
323                        [('I',),
324                         [[],[],[],[],[],[],[],[],[],[]],
325                         [0,0,0,0,0,0,0,0,0,0]],
326                        [('l',),
327                         [[],[],[],[],[],[],[],[],[],[]],
328                         [0,0,0,0,0,0,0,0,0,0]],
329                        [('L',),
330                         [[],[],[],[],[],[],[],[],[],[]],
331                         [0,0,0,0,0,0,0,0,0,0]],
332                        [('f',[]),
333                         [[],[],[],[],[],[],[],[],[],[]],
334                         [0,0,0,0,0,0,0,0,0,0]],
335                        [('d',),
336                         [[],[],[],[],[],[],[],[],[],[]],
337                         [0,0,0,0,0,0,0,0,0,0]],
338
339                        #http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=24303
340                        [('u',u'z'),
341                         [[u'z'],[u'a'],[u'\u6261'],[u'\u6261'],[u'\u6261'],[u'\u6261'],[u'\u6261'],[u'\u6261'],[u'\u6261'],[u'\u6261']],
342                         [0,1,2,2,2,2,2,2,2,2]],
343                        [('u',u'az'),
344                         [[u'a',u'z'],[u'a',u'z'],[u'\u6261',u'z'],[u'\u6261',u'c'],[u'\u6261',u'\u6463'],[u'\u6261',u'\u6463'],[u'\u6261',u'\u6463'],[u'\u6261',u'\u6463'],[u'\u6261',u'\u6463'],[u'\u6261',u'\u6463']],
345                         [0,1,2,3,4,4,4,4,4,4]],
346                        [('u',u'*'),
347                         [[u'*'],[u'a'],[u'\u6261'],[u'\u6261'],[u'\u6261'],[u'\u6261'],[u'\u6261'],[u'\u6261'],[u'\u6261'],[u'\u6261']],
348                         [0,1,2,2,2,2,2,2,2,2]],
349    
350                        #http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=24316
351                        [('h',[-1]),
352                         [[-1],[-159],[25185],[25185],[25185],[25185],[25185],[25185],[25185],[25185]],
353                         [0,1,2,2,2,2,2,2,2,2]],
354    
355                        #http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=24316
356                        [('h',[1,-99,47]),
357                         [[1,-99,47],[97,-99,47],[25185,-99,47],[25185,-157,47],[25185,25699,47],[25185,25699,101],[25185,25699,26213],[25185,25699,26213],[25185,25699,26213],[25185,25699,26213]],
358                         [0,1,2,3,4,5,6,6,6,6]],
359    
360                        #http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=24317
361                        [('i',[1,2]),
362                         [[1,2],[97,2],[25185,2],[6513249,2],[1684234849,2],[1684234849,101],[1684234849,26213],[1684234849,6776421],[1684234849,1751606885],[1684234849,1751606885]],
363                         [0,1,2,3,4,5,6,7,8,8]],
364                        #http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=24316
365                        [('i',[-1]),
366                         [[-1],[-159],[-40351],[-10263967],[1684234849],[1684234849],[1684234849],[1684234849],[1684234849],[1684234849]],
367                         [0,1,2,3,4,4,4,4,4,4]],
368                        #http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=24316
369                        [('i',[1,-99,47]),
370                         [[1,-99,47],[97,-99,47],[25185,-99,47],[6513249,-99,47],[1684234849,-99,47],[1684234849,-155,47],[1684234849,-39323,47],[1684234849,-10000795,47],[1684234849,1751606885,47],[1684234849,1751606885,105]],
371                         [0,1,2,3,4,5,6,7,8,9]],
372    
373                        #http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=24317
374                        [('I',[1L]),
375                         [[1L],[97L],[25185L],[6513249L],[1684234849L],[1684234849L],[1684234849L],[1684234849L],[1684234849L],[1684234849L]],
376                         [0,1,2,3,4,4,4,4,4,4]],
377                        [('I',[1L,999L,47L]),
378                         [[1L,999L,47L],[97L,999L,47L],[25185L,999L,47L],[6513249L,999L,47L],[1684234849L,999L,47L],[1684234849L,869L,47L],[1684234849L,26213L,47L],[1684234849L,6776421L,47L],[1684234849L,1751606885L,47L],[1684234849L,1751606885L,105L]],
379                         [0,1,2,3,4,5,6,7,8,9]],
380    
381                        #http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=24317
382                        [('l',[1,2]),
383                         [[1,2],[97,2],[25185,2],[6513249,2],[1684234849,2],[1684234849,101],[1684234849,26213],[1684234849,6776421],[1684234849,1751606885],[1684234849,1751606885]],
384                         [0,1,2,3,4,5,6,7,8,8]],
385                        [('l',[-1]),
386                         [[-1],[-159],[-40351],[-10263967],[1684234849],[1684234849],[1684234849],[1684234849],[1684234849],[1684234849]],
387                         [0,1,2,3,4,4,4,4,4,4]],
388                        [('l',[1,-99,47]),
389                         [[1,-99,47],[97,-99,47],[25185,-99,47],[6513249,-99,47],[1684234849,-99,47],[1684234849,-155,47],[1684234849,-39323,47],[1684234849,-10000795,47],[1684234849,1751606885,47],[1684234849,1751606885,105]],
390                         [0,1,2,3,4,5,6,7,8,9]],
391                        [('l',[1,-99,47,48]),
392                         [[1,-99,47,48],[97,-99,47,48],[25185,-99,47,48],[6513249,-99,47,48],[1684234849,-99,47,48],[1684234849,-155,47,48],[1684234849,-39323,47,48],[1684234849,-10000795,47,48],[1684234849,1751606885,47,48],[1684234849,1751606885,105,48]],
393                         [0,1,2,3,4,5,6,7,8,9]],
394                        [('l',[1,-99,47,48,49]),
395                         [[1,-99,47,48,49],[97,-99,47,48,49],[25185,-99,47,48,49],[6513249,-99,47,48,49],[1684234849,-99,47,48,49],[1684234849,-155,47,48,49],[1684234849,-39323,47,48,49],[1684234849,-10000795,47,48,49],[1684234849,1751606885,47,48,49],[1684234849,1751606885,105,48,49]],
396                         [0,1,2,3,4,5,6,7,8,9]],
397                        
398                        #http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=24318
399                        [('L',[100000000L]),
400                         [[100000000L],[100000097L],[99967585L],[90399329L],[1684234849L],[1684234849L],[1684234849L],[1684234849L],[1684234849L],[1684234849L]],
401                         [0,1,2,3,4,4,4,4,4,4]],
402                        [('L',[1L,99L,47L]),
403                         [[1L,99L,47L],[97L,99L,47L],[25185L,99L,47L],[6513249L,99L,47L],[1684234849L,99L,47L],[1684234849L,101L,47L],[1684234849L,26213L,47L],[1684234849L,6776421L,47L],[1684234849L,1751606885L,47L],[1684234849L,1751606885L,105L]],
404                         [0,1,2,3,4,5,6,7,8,9]],
405                        
406                        #http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=24319
407                        [('f',[3.1415926535897931]),
408                         [[3.1415927410125732],[3.1415636539459229],[3.1466295719146729],[3.5528795719146729],[1.6777999408082104e+22],[1.6777999408082104e+22],[1.6777999408082104e+22],[1.6777999408082104e+22],[1.6777999408082104e+22],[1.6777999408082104e+22]],
409                         [0,1,2,3,4,4,4,4,4,4]],
410                        [('f',[1.0,3.1400000000000001,0.997]),
411                         [[1.0,3.1400001049041748,0.99699997901916504],[1.0000115633010864,3.1400001049041748,0.99699997901916504],[1.0030022859573364,3.1400001049041748,0.99699997901916504],[0.88821989297866821,3.1400001049041748,0.99699997901916504],[1.6777999408082104e+22,3.1400001049041748,0.99699997901916504],[1.6777999408082104e+22,3.1399776935577393,0.99699997901916504],[1.6777999408082104e+22,3.1312496662139893,0.99699997901916504],[1.6777999408082104e+22,3.6156246662139893,0.99699997901916504],[1.6777999408082104e+22,4.371022013021617e+24,0.99699997901916504],[1.6777999408082104e+22,4.371022013021617e+24,0.99700027704238892]],
412                         [0,1,2,3,4,5,6,7,8,9]],
413                        
414                        #http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=24319
415                        [('d',[3.1415926535897931]),
416                         [[3.1415926535897931],[3.1415926535898255],[3.1415926535958509],[3.1415926544980697],[3.1415927737073592],[3.1413066714124374],[3.1749980776624374],[187.19987697039599],[8.5408832230361244e+194],[8.5408832230361244e+194]],
417                         [0,1,2,3,4,5,6,7,8,8]],
418                        [('d',[1.0,3.1400000000000001,0.99734343339999998,1.1000000000000001,2.2000000000000002,3.2999999999999998,4.4000000000000004]),
419                         [[1.0,3.1400000000000001,0.99734343339999998,1.1000000000000001,2.2000000000000002,3.2999999999999998,4.4000000000000004],[1.0000000000000215,3.1400000000000001,0.99734343339999998,1.1000000000000001,2.2000000000000002,3.2999999999999998,4.4000000000000004],[1.0000000000055922,3.1400000000000001,0.99734343339999998,1.1000000000000001,2.2000000000000002,3.2999999999999998,4.4000000000000004],[1.0000000014462318,3.1400000000000001,0.99734343339999998,1.1000000000000001,2.2000000000000002,3.2999999999999998,4.4000000000000004],[1.0000003739752616,3.1400000000000001,0.99734343339999998,1.1000000000000001,2.2000000000000002,3.2999999999999998,4.4000000000000004],[1.0000966950812187,3.1400000000000001,0.99734343339999998,1.1000000000000001,2.2000000000000002,3.2999999999999998,4.4000000000000004],[1.0249990388312187,3.1400000000000001,0.99734343339999998,1.1000000000000001,2.2000000000000002,3.2999999999999998,4.4000000000000004],[0.002856443435217224,3.1400000000000001,0.99734343339999998,1.1000000000000001,2.2000000000000002,3.2999999999999998,4.4000000000000004],[8.5408832230361244e+194,3.1400000000000001,0.99734343339999998,1.1000000000000001,2.2000000000000002,3.2999999999999998,4.4000000000000004],[8.5408832230361244e+194,3.140000000000033,0.99734343339999998,1.1000000000000001,2.2000000000000002,3.2999999999999998,4.4000000000000004]],
420                         [0,1,2,3,4,5,6,7,8,9]],
421                        [('d',[1.0,3.1400000000000001,0.99734343339999998,1.1000000000000001,2.2000000000000002,3.2999999999999998,4.4000000000000004,5.5]),
422                         [[1.0,3.1400000000000001,0.99734343339999998,1.1000000000000001,2.2000000000000002,3.2999999999999998,4.4000000000000004,5.5],[1.0000000000000215,3.1400000000000001,0.99734343339999998,1.1000000000000001,2.2000000000000002,3.2999999999999998,4.4000000000000004,5.5],[1.0000000000055922,3.1400000000000001,0.99734343339999998,1.1000000000000001,2.2000000000000002,3.2999999999999998,4.4000000000000004,5.5],[1.0000000014462318,3.1400000000000001,0.99734343339999998,1.1000000000000001,2.2000000000000002,3.2999999999999998,4.4000000000000004,5.5],[1.0000003739752616,3.1400000000000001,0.99734343339999998,1.1000000000000001,2.2000000000000002,3.2999999999999998,4.4000000000000004,5.5],[1.0000966950812187,3.1400000000000001,0.99734343339999998,1.1000000000000001,2.2000000000000002,3.2999999999999998,4.4000000000000004,5.5],[1.0249990388312187,3.1400000000000001,0.99734343339999998,1.1000000000000001,2.2000000000000002,3.2999999999999998,4.4000000000000004,5.5],[0.002856443435217224,3.1400000000000001,0.99734343339999998,1.1000000000000001,2.2000000000000002,3.2999999999999998,4.4000000000000004,5.5],[8.5408832230361244e+194,3.1400000000000001,0.99734343339999998,1.1000000000000001,2.2000000000000002,3.2999999999999998,4.4000000000000004,5.5],[8.5408832230361244e+194,3.140000000000033,0.99734343339999998,1.1000000000000001,2.2000000000000002,3.2999999999999998,4.4000000000000004,5.5]],
423                         [0,1,2,3,4,5,6,7,8,9]],
424                        [('d',[1.0,3.1400000000000001,0.99734343339999998,1.1000000000000001,2.2000000000000002,3.2999999999999998,4.4000000000000004,5.5,6.5999999999999996]),
425                         [[1.0,3.1400000000000001,0.99734343339999998,1.1000000000000001,2.2000000000000002,3.2999999999999998,4.4000000000000004,5.5,6.5999999999999996],[1.0000000000000215,3.1400000000000001,0.99734343339999998,1.1000000000000001,2.2000000000000002,3.2999999999999998,4.4000000000000004,5.5,6.5999999999999996],[1.0000000000055922,3.1400000000000001,0.99734343339999998,1.1000000000000001,2.2000000000000002,3.2999999999999998,4.4000000000000004,5.5,6.5999999999999996],[1.0000000014462318,3.1400000000000001,0.99734343339999998,1.1000000000000001,2.2000000000000002,3.2999999999999998,4.4000000000000004,5.5,6.5999999999999996],[1.0000003739752616,3.1400000000000001,0.99734343339999998,1.1000000000000001,2.2000000000000002,3.2999999999999998,4.4000000000000004,5.5,6.5999999999999996],[1.0000966950812187,3.1400000000000001,0.99734343339999998,1.1000000000000001,2.2000000000000002,3.2999999999999998,4.4000000000000004,5.5,6.5999999999999996],[1.0249990388312187,3.1400000000000001,0.99734343339999998,1.1000000000000001,2.2000000000000002,3.2999999999999998,4.4000000000000004,5.5,6.5999999999999996],[0.002856443435217224,3.1400000000000001,0.99734343339999998,1.1000000000000001,2.2000000000000002,3.2999999999999998,4.4000000000000004,5.5,6.5999999999999996],[8.5408832230361244e+194,3.1400000000000001,0.99734343339999998,1.1000000000000001,2.2000000000000002,3.2999999999999998,4.4000000000000004,5.5,6.5999999999999996],[8.5408832230361244e+194,3.140000000000033,0.99734343339999998,1.1000000000000001,2.2000000000000002,3.2999999999999998,4.4000000000000004,5.5,6.5999999999999996]],
426                         [0,1,2,3,4,5,6,7,8,9]],
427                    ]
428
429    #Cases working correctly under IronPython
430    for a_params, a_expected, f_expected in readinto_cases:
431        f_list = fileio_helper()
432        
433        for i in xrange(len(f_list)):
434            a = array.array(*a_params)
435            f = f_list[i]
436            
437            AreEqual(f.readinto(a),
438                     f_expected[i])
439            AreEqual(a.tolist(),
440                     a_expected[i])
441        
442        #cleanup
443        for f in f_list: 
444            f.close()
445        for i in xrange(len(f_list)):
446            os.remove(TEMP_READINTO_NAME % i)
447
448    
449#--MAIN------------------------------------------------------------------------
450run_test(__name__)