summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_socket.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_socket.py')
-rw-r--r--Lib/test/test_socket.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index 7716d33..d7c9a31 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -1245,6 +1245,17 @@ class GeneralModuleTests(unittest.TestCase):
fp.close()
self.assertEqual(repr(fp), "<_io.BufferedReader name=-1>")
+ def test_unusable_closed_socketio(self):
+ with socket.socket() as sock:
+ fp = sock.makefile("rb", buffering=0)
+ self.assertTrue(fp.readable())
+ self.assertFalse(fp.writable())
+ self.assertFalse(fp.seekable())
+ fp.close()
+ self.assertRaises(ValueError, fp.readable)
+ self.assertRaises(ValueError, fp.writable)
+ self.assertRaises(ValueError, fp.seekable)
+
def test_pickle(self):
sock = socket.socket()
with sock: