diff options
| author | Ethan Furman <ethan@stoneleaf.us> | 2014-10-14 18:56:53 -0700 |
|---|---|---|
| committer | Ethan Furman <ethan@stoneleaf.us> | 2014-10-14 18:56:53 -0700 |
| commit | 7184bac5446aefcf576bc8a0a666cfd096b86293 (patch) | |
| tree | 202d81f8303e93df8f99327285ac0bee3a4e6ad7 /Lib/test/test_socket.py | |
| parent | 00bdce3e1077357547831ef3ab12ba705225bcf8 (diff) | |
| download | cpython-git-7184bac5446aefcf576bc8a0a666cfd096b86293.tar.gz | |
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 28bf8f5cc1..15e764098b 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -649,6 +649,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: @@ -1224,7 +1231,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) @@ -1396,7 +1403,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): |
