Commits

Alexandre Vassalotti committed 02a8142

Added tests to check the buffer type returned during reading.

Comments (0)

Files changed (1)

Lib/test/test_memoryio.py

         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()
         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()
         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()
         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)