diff options
author | Ethan Furman <ethan@stoneleaf.us> | 2014-10-15 01:57:58 (GMT) |
---|---|---|
committer | Ethan Furman <ethan@stoneleaf.us> | 2014-10-15 01:57:58 (GMT) |
commit | 41d31967c6bcc7e730a0db77cfe1dc334c6d853e (patch) | |
tree | 52c27efa0546ca61a7bac9fd037a1aebac696487 /Lib/test/test_socket.py | |
parent | c597d5c318dc9af27d99a70074688578caf82890 (diff) | |
parent | 7184bac5446aefcf576bc8a0a666cfd096b86293 (diff) | |
download | cpython-41d31967c6bcc7e730a0db77cfe1dc334c6d853e.zip cpython-41d31967c6bcc7e730a0db77cfe1dc334c6d853e.tar.gz cpython-41d31967c6bcc7e730a0db77cfe1dc334c6d853e.tar.bz2 |
Issue20386: SocketType is again socket.socket; the IntEnum SOCK constants are SocketKind
Diffstat (limited to 'Lib/test/test_socket.py')
-rw-r--r-- | Lib/test/test_socket.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index ca79532..7b93d11 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -651,6 +651,13 @@ def requireSocket(*args): class GeneralModuleTests(unittest.TestCase): + def test_SocketType_is_socketobject(self): + import _socket + self.assertTrue(socket.SocketType is _socket.socket) + s = socket.socket() + self.assertIsInstance(s, socket.SocketType) + s.close() + def test_repr(self): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) with s: @@ -1226,7 +1233,7 @@ class GeneralModuleTests(unittest.TestCase): self.assertEqual(family, socket.AF_INET) self.assertEqual(str(family), 'AddressFamily.AF_INET') self.assertEqual(type, socket.SOCK_STREAM) - self.assertEqual(str(type), 'SocketType.SOCK_STREAM') + self.assertEqual(str(type), 'SocketKind.SOCK_STREAM') infos = socket.getaddrinfo(HOST, None, 0, socket.SOCK_STREAM) for _, socktype, _, _, _ in infos: self.assertEqual(socktype, socket.SOCK_STREAM) @@ -1401,7 +1408,7 @@ class GeneralModuleTests(unittest.TestCase): # reprs. with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: self.assertEqual(str(s.family), 'AddressFamily.AF_INET') - self.assertEqual(str(s.type), 'SocketType.SOCK_STREAM') + self.assertEqual(str(s.type), 'SocketKind.SOCK_STREAM') @unittest.skipIf(os.name == 'nt', 'Will not work on Windows') def test_uknown_socket_family_repr(self): |