Added tests to check the buffer type returned during reading.
This commit is contained in:
parent
77250f4df7
commit
5da31eb261
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue