summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_memoryio.py
diff options
context:
space:
mode:
authorAlexandre Vassalotti <alexandre@peadrop.com>2008-05-06 20:30:41 (GMT)
committerAlexandre Vassalotti <alexandre@peadrop.com>2008-05-06 20:30:41 (GMT)
commit5da31eb261e4889daf731ec5d88f5a1af3503423 (patch)
tree9221c5081259074f0eb2a14f2b79a82dc71b27d6 /Lib/test/test_memoryio.py
parent77250f4df7a73a5c87d12d781a562747a855cd95 (diff)
downloadcpython-5da31eb261e4889daf731ec5d88f5a1af3503423.zip
cpython-5da31eb261e4889daf731ec5d88f5a1af3503423.tar.gz
cpython-5da31eb261e4889daf731ec5d88f5a1af3503423.tar.bz2
Added tests to check the buffer type returned during reading.
Diffstat (limited to 'Lib/test/test_memoryio.py')
-rw-r--r--Lib/test/test_memoryio.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_memoryio.py b/Lib/test/test_memoryio.py
index 0b09ca4..2f5982f 100644
--- a/Lib/test/test_memoryio.py
+++ b/Lib/test/test_memoryio.py
@@ -113,6 +113,8 @@ class MemoryTestMixin:
memio.seek(0)
self.assertEqual(memio.read(-1), buf)
memio.seek(0)
+ self.assertEqual(type(memio.read()), type(buf))
+ memio.seek(0)
self.assertEqual(memio.read(None), buf)
self.assertRaises(TypeError, memio.read, '')
memio.close()
@@ -142,6 +144,7 @@ class MemoryTestMixin:
self.assertEqual(memio.readline(), buf[:-1])
self.assertEqual(memio.readline(), self.EOF)
memio.seek(0)
+ self.assertEqual(type(memio.readline()), type(buf))
self.assertEqual(memio.readline(None), buf)
self.assertRaises(TypeError, memio.readline, '')
memio.close()
@@ -161,6 +164,8 @@ class MemoryTestMixin:
memio.seek(0)
self.assertEqual(memio.readlines(0), [buf] * 10)
memio.seek(0)
+ self.assertEqual(type(memio.readlines()[0]), type(buf))
+ memio.seek(0)
self.assertEqual(memio.readlines(None), [buf] * 10)
self.assertRaises(TypeError, memio.readlines, '')
memio.close()
@@ -195,6 +200,7 @@ class MemoryTestMixin:
self.assertEqual(memio.getvalue(), buf)
memio.read()
self.assertEqual(memio.getvalue(), buf)
+ self.assertEqual(type(memio.getvalue()), type(buf))
memio = self.ioclass(buf * 1000)
self.assertEqual(memio.getvalue()[-3:], self.buftype("890"))
memio = self.ioclass(buf)