PageRenderTime 50ms CodeModel.GetById 21ms RepoModel.GetById 0ms 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
Possible License(s): GPL-2.0, MPL-2.0-no-copyleft-exception, CPL-1.0, CC-BY-SA-3.0, BSD-3-Clause, ISC, AGPL-3.0, LGPL-2.1, Apache-2.0
  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. '''
  16. Tests for CPython's _fileio module.
  17. '''
  18. #--IMPORTS---------------------------------------------------------------------
  19. from iptest.assert_util import *
  20. skiptest("silverlight")
  21. import sys, os
  22. if sys.winver == '2.6':
  23. import _fileio
  24. FileIO = _fileio._FileIO
  25. else:
  26. from _io import FileIO
  27. #--GLOBALS---------------------------------------------------------------------
  28. TEMP_READINTO_NAME = "_fileio__FileIO_readinto%d.tmp"
  29. #--HELPERS---------------------------------------------------------------------
  30. def bytesio_helper():
  31. return (bytes(bytearray(b'')),
  32. bytes(bytearray(b'a')),
  33. bytes(bytearray(b'ab')),
  34. bytes(bytearray(b'abc')),
  35. bytes(bytearray(b'abcd')),
  36. bytes(bytearray(b'abcde')),
  37. bytes(bytearray(b'abcdef')),
  38. bytes(bytearray(b'abcdefg')),
  39. bytes(bytearray(b'abcdefgh')),
  40. bytes(bytearray(b'abcdefghi'))
  41. )
  42. def fileio_helper():
  43. bytes_io_list = bytesio_helper()
  44. file_io_list = []
  45. for i in xrange(len(bytes_io_list)):
  46. f = FileIO(TEMP_READINTO_NAME % i, "w")
  47. f.write(bytes_io_list[i])
  48. f.close()
  49. file_io_list.append(FileIO(TEMP_READINTO_NAME % i, "r"))
  50. return file_io_list
  51. #--TEST CASES------------------------------------------------------------------
  52. def test__FileIO___class__():
  53. '''
  54. TODO
  55. '''
  56. pass
  57. def test__FileIO___delattr__():
  58. '''
  59. TODO
  60. '''
  61. pass
  62. def test__FileIO___doc__():
  63. '''
  64. TODO
  65. '''
  66. pass
  67. def test__FileIO___format__():
  68. '''
  69. TODO
  70. '''
  71. pass
  72. def test__FileIO___getattribute__():
  73. '''
  74. TODO
  75. '''
  76. pass
  77. def test__FileIO___hash__():
  78. '''
  79. TODO
  80. '''
  81. pass
  82. def test__FileIO___init__():
  83. '''
  84. TODO
  85. '''
  86. pass
  87. def test__FileIO___new__():
  88. '''
  89. TODO
  90. '''
  91. pass
  92. def test__FileIO___reduce__():
  93. '''
  94. TODO
  95. '''
  96. pass
  97. def test__FileIO___reduce_ex__():
  98. '''
  99. TODO
  100. '''
  101. pass
  102. def test__FileIO___repr__():
  103. '''
  104. TODO
  105. '''
  106. pass
  107. def test__FileIO___setattr__():
  108. '''
  109. TODO
  110. '''
  111. pass
  112. def test__FileIO___sizeof__():
  113. '''
  114. TODO
  115. '''
  116. pass
  117. def test__FileIO___str__():
  118. '''
  119. TODO
  120. '''
  121. pass
  122. def test__FileIO___subclasshook__():
  123. '''
  124. TODO
  125. '''
  126. pass
  127. def test__FileIO_close():
  128. '''
  129. TODO
  130. '''
  131. pass
  132. def test__FileIO_closed():
  133. '''
  134. TODO
  135. '''
  136. pass
  137. def test__FileIO_closefd():
  138. '''
  139. TODO
  140. '''
  141. pass
  142. def test__FileIO_fileno():
  143. '''
  144. TODO
  145. '''
  146. pass
  147. def test__FileIO_isatty():
  148. '''
  149. TODO
  150. '''
  151. pass
  152. def test__FileIO_mode():
  153. '''
  154. TODO
  155. '''
  156. pass
  157. def test__FileIO_read():
  158. '''
  159. TODO
  160. '''
  161. pass
  162. def test__FileIO_readable():
  163. '''
  164. TODO
  165. '''
  166. pass
  167. def test__FileIO_readall():
  168. '''
  169. TODO
  170. '''
  171. pass
  172. def test__FileIO_readinto():
  173. '''
  174. TODO
  175. '''
  176. pass
  177. def test__FileIO_seek():
  178. '''
  179. TODO
  180. '''
  181. pass
  182. def test__FileIO_seekable():
  183. '''
  184. TODO
  185. '''
  186. pass
  187. def test__FileIO_tell():
  188. '''
  189. TODO
  190. '''
  191. pass
  192. def test__FileIO_truncate():
  193. '''
  194. TODO
  195. '''
  196. pass
  197. def test__FileIO_writable():
  198. '''
  199. TODO
  200. '''
  201. pass
  202. def test__FileIO_write():
  203. '''
  204. TODO
  205. '''
  206. pass
  207. def test_coverage():
  208. '''
  209. Test holes as found by code coverage runs. These need to be refactored and
  210. moved to other functions throughout this module (TODO).
  211. '''
  212. #--FileIO.readinto(array.array(...))
  213. import array
  214. readinto_cases = [
  215. [('c',),
  216. [[],[],[],[],[],[],[],[],[],[]],
  217. [0,0,0,0,0,0,0,0,0,0]],
  218. [('c',['z']),
  219. [['z'],['a'],['a'],['a'],['a'],['a'],['a'],['a'],['a'],['a']],
  220. [0,1,1,1,1,1,1,1,1,1]],
  221. [('c',['a','z']),
  222. [['a','z'],['a','z'],['a','b'],['a','b'],['a','b'],['a','b'],['a','b'],['a','b'],['a','b'],['a','b']],
  223. [0,1,2,2,2,2,2,2,2,2]],
  224. [('b',),
  225. [[],[],[],[],[],[],[],[],[],[]],
  226. [0,0,0,0,0,0,0,0,0,0]],
  227. [('b',[0]),
  228. [[0],[97],[97],[97],[97],[97],[97],[97],[97],[97]],
  229. [0,1,1,1,1,1,1,1,1,1]],
  230. [('b',[0,-1]),
  231. [[0,-1],[97,-1],[97,98],[97,98],[97,98],[97,98],[97,98],[97,98],[97,98],[97,98]],
  232. [0,1,2,2,2,2,2,2,2,2]],
  233. [('b',[0,1,2]),
  234. [[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]],
  235. [0,1,2,3,3,3,3,3,3,3]],
  236. [('b',[0,1,2,3,4,5,6]),
  237. [[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]],
  238. [0,1,2,3,4,5,6,7,7,7]],
  239. [('b',[0,1,2,3,4,5,6,7]),
  240. [[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]],
  241. [0,1,2,3,4,5,6,7,8,8]],
  242. [('b',[0,1,2,3,4,5,6,7,8]),
  243. [[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]],
  244. [0,1,2,3,4,5,6,7,8,9]],
  245. [('b',[0,1,2,3,4,5,6,7,8,9]),
  246. [[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]],
  247. [0,1,2,3,4,5,6,7,8,9]],
  248. [('B',),
  249. [[],[],[],[],[],[],[],[],[],[]],
  250. [0,0,0,0,0,0,0,0,0,0]],
  251. [('B',[0,1]),
  252. [[0,1],[97,1],[97,98],[97,98],[97,98],[97,98],[97,98],[97,98],[97,98],[97,98]],
  253. [0,1,2,2,2,2,2,2,2,2]],
  254. [('u',),
  255. [[],[],[],[],[],[],[],[],[],[]],
  256. [0,0,0,0,0,0,0,0,0,0]],
  257. [('u',u''),
  258. [[],[],[],[],[],[],[],[],[],[]],
  259. [0,0,0,0,0,0,0,0,0,0]],
  260. [('h',),
  261. [[],[],[],[],[],[],[],[],[],[]],
  262. [0,0,0,0,0,0,0,0,0,0]],
  263. [('h',[1,2]),
  264. [[1,2],[97,2],[25185,2],[25185,99],[25185,25699],[25185,25699],[25185,25699],[25185,25699],[25185,25699],[25185,25699]],
  265. [0,1,2,3,4,4,4,4,4,4]],
  266. [('H',),
  267. [[],[],[],[],[],[],[],[],[],[]],
  268. [0,0,0,0,0,0,0,0,0,0]],
  269. [('H',[]),
  270. [[],[],[],[],[],[],[],[],[],[]],
  271. [0,0,0,0,0,0,0,0,0,0]],
  272. [('H',[49]),
  273. [[49],[97],[25185],[25185],[25185],[25185],[25185],[25185],[25185],[25185]],
  274. [0,1,2,2,2,2,2,2,2,2]],
  275. [('H',[2,3]),
  276. [[2,3],[97,3],[25185,3],[25185,99],[25185,25699],[25185,25699],[25185,25699],[25185,25699],[25185,25699],[25185,25699]],
  277. [0,1,2,3,4,4,4,4,4,4]],
  278. [('i',),
  279. [[],[],[],[],[],[],[],[],[],[]],
  280. [0,0,0,0,0,0,0,0,0,0]],
  281. [('I',),
  282. [[],[],[],[],[],[],[],[],[],[]],
  283. [0,0,0,0,0,0,0,0,0,0]],
  284. [('l',),
  285. [[],[],[],[],[],[],[],[],[],[]],
  286. [0,0,0,0,0,0,0,0,0,0]],
  287. [('L',),
  288. [[],[],[],[],[],[],[],[],[],[]],
  289. [0,0,0,0,0,0,0,0,0,0]],
  290. [('f',[]),
  291. [[],[],[],[],[],[],[],[],[],[]],
  292. [0,0,0,0,0,0,0,0,0,0]],
  293. [('d',),
  294. [[],[],[],[],[],[],[],[],[],[]],
  295. [0,0,0,0,0,0,0,0,0,0]],
  296. #http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=24303
  297. [('u',u'z'),
  298. [[u'z'],[u'a'],[u'\u6261'],[u'\u6261'],[u'\u6261'],[u'\u6261'],[u'\u6261'],[u'\u6261'],[u'\u6261'],[u'\u6261']],
  299. [0,1,2,2,2,2,2,2,2,2]],
  300. [('u',u'az'),
  301. [[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']],
  302. [0,1,2,3,4,4,4,4,4,4]],
  303. [('u',u'*'),
  304. [[u'*'],[u'a'],[u'\u6261'],[u'\u6261'],[u'\u6261'],[u'\u6261'],[u'\u6261'],[u'\u6261'],[u'\u6261'],[u'\u6261']],
  305. [0,1,2,2,2,2,2,2,2,2]],
  306. #http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=24316
  307. [('h',[-1]),
  308. [[-1],[-159],[25185],[25185],[25185],[25185],[25185],[25185],[25185],[25185]],
  309. [0,1,2,2,2,2,2,2,2,2]],
  310. #http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=24316
  311. [('h',[1,-99,47]),
  312. [[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]],
  313. [0,1,2,3,4,5,6,6,6,6]],
  314. #http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=24317
  315. [('i',[1,2]),
  316. [[1,2],[97,2],[25185,2],[6513249,2],[1684234849,2],[1684234849,101],[1684234849,26213],[1684234849,6776421],[1684234849,1751606885],[1684234849,1751606885]],
  317. [0,1,2,3,4,5,6,7,8,8]],
  318. #http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=24316
  319. [('i',[-1]),
  320. [[-1],[-159],[-40351],[-10263967],[1684234849],[1684234849],[1684234849],[1684234849],[1684234849],[1684234849]],
  321. [0,1,2,3,4,4,4,4,4,4]],
  322. #http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=24316
  323. [('i',[1,-99,47]),
  324. [[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]],
  325. [0,1,2,3,4,5,6,7,8,9]],
  326. #http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=24317
  327. [('I',[1L]),
  328. [[1L],[97L],[25185L],[6513249L],[1684234849L],[1684234849L],[1684234849L],[1684234849L],[1684234849L],[1684234849L]],
  329. [0,1,2,3,4,4,4,4,4,4]],
  330. [('I',[1L,999L,47L]),
  331. [[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]],
  332. [0,1,2,3,4,5,6,7,8,9]],
  333. #http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=24317
  334. [('l',[1,2]),
  335. [[1,2],[97,2],[25185,2],[6513249,2],[1684234849,2],[1684234849,101],[1684234849,26213],[1684234849,6776421],[1684234849,1751606885],[1684234849,1751606885]],
  336. [0,1,2,3,4,5,6,7,8,8]],
  337. [('l',[-1]),
  338. [[-1],[-159],[-40351],[-10263967],[1684234849],[1684234849],[1684234849],[1684234849],[1684234849],[1684234849]],
  339. [0,1,2,3,4,4,4,4,4,4]],
  340. [('l',[1,-99,47]),
  341. [[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]],
  342. [0,1,2,3,4,5,6,7,8,9]],
  343. [('l',[1,-99,47,48]),
  344. [[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]],
  345. [0,1,2,3,4,5,6,7,8,9]],
  346. [('l',[1,-99,47,48,49]),
  347. [[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]],
  348. [0,1,2,3,4,5,6,7,8,9]],
  349. #http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=24318
  350. [('L',[100000000L]),
  351. [[100000000L],[100000097L],[99967585L],[90399329L],[1684234849L],[1684234849L],[1684234849L],[1684234849L],[1684234849L],[1684234849L]],
  352. [0,1,2,3,4,4,4,4,4,4]],
  353. [('L',[1L,99L,47L]),
  354. [[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]],
  355. [0,1,2,3,4,5,6,7,8,9]],
  356. #http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=24319
  357. [('f',[3.1415926535897931]),
  358. [[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]],
  359. [0,1,2,3,4,4,4,4,4,4]],
  360. [('f',[1.0,3.1400000000000001,0.997]),
  361. [[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]],
  362. [0,1,2,3,4,5,6,7,8,9]],
  363. #http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=24319
  364. [('d',[3.1415926535897931]),
  365. [[3.1415926535897931],[3.1415926535898255],[3.1415926535958509],[3.1415926544980697],[3.1415927737073592],[3.1413066714124374],[3.1749980776624374],[187.19987697039599],[8.5408832230361244e+194],[8.5408832230361244e+194]],
  366. [0,1,2,3,4,5,6,7,8,8]],
  367. [('d',[1.0,3.1400000000000001,0.99734343339999998,1.1000000000000001,2.2000000000000002,3.2999999999999998,4.4000000000000004]),
  368. [[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]],
  369. [0,1,2,3,4,5,6,7,8,9]],
  370. [('d',[1.0,3.1400000000000001,0.99734343339999998,1.1000000000000001,2.2000000000000002,3.2999999999999998,4.4000000000000004,5.5]),
  371. [[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]],
  372. [0,1,2,3,4,5,6,7,8,9]],
  373. [('d',[1.0,3.1400000000000001,0.99734343339999998,1.1000000000000001,2.2000000000000002,3.2999999999999998,4.4000000000000004,5.5,6.5999999999999996]),
  374. [[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]],
  375. [0,1,2,3,4,5,6,7,8,9]],
  376. ]
  377. #Cases working correctly under IronPython
  378. for a_params, a_expected, f_expected in readinto_cases:
  379. f_list = fileio_helper()
  380. for i in xrange(len(f_list)):
  381. a = array.array(*a_params)
  382. f = f_list[i]
  383. AreEqual(f.readinto(a),
  384. f_expected[i])
  385. AreEqual(a.tolist(),
  386. a_expected[i])
  387. #cleanup
  388. for f in f_list:
  389. f.close()
  390. for i in xrange(len(f_list)):
  391. os.remove(TEMP_READINTO_NAME % i)
  392. #--MAIN------------------------------------------------------------------------
  393. run_test(__name__)