From: <fwi...@us...> - 2009-08-16 15:32:14
|
Revision: 6679 http://jython.svn.sourceforge.net/jython/?rev=6679&view=rev Author: fwierzbicki Date: 2009-08-16 15:32:04 +0000 (Sun, 16 Aug 2009) Log Message: ----------- Test file.write(array) Modified Paths: -------------- trunk/jython/Lib/test/test_array.py Modified: trunk/jython/Lib/test/test_array.py =================================================================== --- trunk/jython/Lib/test/test_array.py 2009-08-16 14:32:28 UTC (rev 6678) +++ trunk/jython/Lib/test/test_array.py 2009-08-16 15:32:04 UTC (rev 6679) @@ -216,6 +216,25 @@ if a.itemsize>1 and self.typecode not in ('b', 'B'): self.assertRaises(ValueError, b.fromstring, "x") + def test_filewrite(self): + a = array.array(self.typecode, 2*self.example) + f = open(test_support.TESTFN, 'wb') + try: + f.write(a) + f.close() + b = array.array(self.typecode) + f = open(test_support.TESTFN, 'rb') + b.fromfile(f, len(self.example)) + self.assertEqual(b, array.array(self.typecode, self.example)) + self.assertNotEqual(a, b) + b.fromfile(f, len(self.example)) + self.assertEqual(a, b) + f.close() + finally: + if not f.closed: + f.close() + test_support.unlink(test_support.TESTFN) + def test_repr(self): a = array.array(self.typecode, 2*self.example) self.assertEqual(a, eval(repr(a), {"array": array.array})) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |