diff Lib/test/test_bytes.py @ 48623:bf50085fbcd3

#2538: bytes objects can only provide read-only buffers
author Antoine Pitrou <solipsis@pitrou.net>
date Sat, 02 Aug 2008 21:02:48 +0000
parents b9828b2a51c0
children e0c65922b878
line wrap: on
line diff
--- a/Lib/test/test_bytes.py	Sat Aug 02 16:34:27 2008 +0000
+++ b/Lib/test/test_bytes.py	Sat Aug 02 21:02:48 2008 +0000
@@ -453,6 +453,11 @@
 class BytesTest(BaseBytesTest):
     type2test = bytes
 
+    def test_buffer_is_readonly(self):
+        with open(sys.stdin.fileno(), "rb", buffering=0) as f:
+            self.assertRaises(TypeError, f.readinto, b"")
+
+
 class ByteArrayTest(BaseBytesTest):
     type2test = bytearray