[Python-checkins] r57264 - python/branches/alex-py3k/Lib/test/test_io.py
alexandre.vassalotti
python-checkins at python.org
Tue Aug 21 20:24:49 CEST 2007
Author: alexandre.vassalotti
Date: Tue Aug 21 20:24:48 2007
New Revision: 57264
Modified:
python/branches/alex-py3k/Lib/test/test_io.py
Log:
Remove tests for StringIO and BytesIO.
Fix failing tests due to the new truncate() behaviour.
Modified: python/branches/alex-py3k/Lib/test/test_io.py
==============================================================================
--- python/branches/alex-py3k/Lib/test/test_io.py (original)
+++ python/branches/alex-py3k/Lib/test/test_io.py Tue Aug 21 20:24:48 2007
@@ -94,7 +94,7 @@
self.assertEqual(f.seek(-1, 2), 13)
self.assertEqual(f.tell(), 13)
self.assertEqual(f.truncate(12), 12)
- self.assertEqual(f.tell(), 13)
+ self.assertEqual(f.tell(), 12)
def read_ops(self, f, buffered=False):
data = f.read(5)
@@ -136,7 +136,7 @@
self.assertEqual(f.tell(), self.LARGE + 2)
self.assertEqual(f.seek(0, 2), self.LARGE + 2)
self.assertEqual(f.truncate(self.LARGE + 1), self.LARGE + 1)
- self.assertEqual(f.tell(), self.LARGE + 2)
+ self.assertEqual(f.tell(), self.LARGE + 1)
self.assertEqual(f.seek(0, 2), self.LARGE + 1)
self.assertEqual(f.seek(-1, 2), self.LARGE)
self.assertEqual(f.read(2), b"x")
@@ -181,14 +181,6 @@
self.assertEqual(f.readline(), b"foo")
f.close()
- def test_raw_bytes_io(self):
- f = io.BytesIO()
- self.write_ops(f)
- data = f.getvalue()
- self.assertEqual(data, b"hello world\n")
- f = io.BytesIO(data)
- self.read_ops(f, True)
-
def test_large_file_ops(self):
# On Windows and Mac OSX this test comsumes large resources; It takes
# a long time to build the >2GB file and takes >2GB of disk space
@@ -260,62 +252,6 @@
f.close()
-class MemorySeekTestMixin:
-
- def testInit(self):
- buf = self.buftype("1234567890")
- bytesIo = self.ioclass(buf)
-
- def testRead(self):
- buf = self.buftype("1234567890")
- bytesIo = self.ioclass(buf)
-
- self.assertEquals(buf[:1], bytesIo.read(1))
- self.assertEquals(buf[1:5], bytesIo.read(4))
- self.assertEquals(buf[5:], bytesIo.read(900))
- self.assertEquals(self.EOF, bytesIo.read())
-
- def testReadNoArgs(self):
- buf = self.buftype("1234567890")
- bytesIo = self.ioclass(buf)
-
- self.assertEquals(buf, bytesIo.read())
- self.assertEquals(self.EOF, bytesIo.read())
-
- def testSeek(self):
- buf = self.buftype("1234567890")
- bytesIo = self.ioclass(buf)
-
- bytesIo.read(5)
- bytesIo.seek(0)
- self.assertEquals(buf, bytesIo.read())
-
- bytesIo.seek(3)
- self.assertEquals(buf[3:], bytesIo.read())
-
- def testTell(self):
- buf = self.buftype("1234567890")
- bytesIo = self.ioclass(buf)
-
- self.assertEquals(0, bytesIo.tell())
- bytesIo.seek(5)
- self.assertEquals(5, bytesIo.tell())
- bytesIo.seek(10000)
- self.assertEquals(10000, bytesIo.tell())
-
-
-class BytesIOTest(MemorySeekTestMixin, unittest.TestCase):
- buftype = bytes
- ioclass = io.BytesIO
- EOF = b""
-
-
-class StringIOTest(MemorySeekTestMixin, unittest.TestCase):
- buftype = str
- ioclass = io.StringIO
- EOF = ""
-
-
class BufferedReaderTest(unittest.TestCase):
def testRead(self):
@@ -739,8 +675,7 @@
# XXX Tests for open()
def test_main():
- test_support.run_unittest(IOTest, BytesIOTest, StringIOTest,
- BufferedReaderTest,
+ test_support.run_unittest(IOTest, BufferedReaderTest,
BufferedWriterTest, BufferedRWPairTest,
BufferedRandomTest, TextIOWrapperTest)
More information about the Python-checkins
mailing list