summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_bytes.py5
-rw-r--r--Lib/test/test_socket.py4
2 files changed, 7 insertions, 2 deletions
diff --git a/Lib/test/test_bytes.py b/Lib/test/test_bytes.py
index 5bda935..230dbf4 100644
--- a/Lib/test/test_bytes.py
+++ b/Lib/test/test_bytes.py
@@ -453,6 +453,11 @@ class BaseBytesTest(unittest.TestCase):
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
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index 222c42c..9d753b7 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -1112,7 +1112,7 @@ class BufferIOTest(SocketConnectedTest):
SocketConnectedTest.__init__(self, methodName=methodName)
def testRecvInto(self):
- buf = b" "*1024
+ buf = bytearray(1024)
nbytes = self.cli_conn.recv_into(buf)
self.assertEqual(nbytes, len(MSG))
msg = buf[:len(MSG)]
@@ -1123,7 +1123,7 @@ class BufferIOTest(SocketConnectedTest):
self.serv_conn.send(buf)
def testRecvFromInto(self):
- buf = b" "*1024
+ buf = bytearray(1024)
nbytes, addr = self.cli_conn.recvfrom_into(buf)
self.assertEqual(nbytes, len(MSG))
msg = buf[:len(MSG)]