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)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.