diff options
author | Ethan Furman <ethan@stoneleaf.us> | 2022-01-17 16:52:42 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-17 16:52:42 (GMT) |
commit | 62a6594e66ca955073be2f4e5a40291a39252ef3 (patch) | |
tree | b0a413800df355e05dcc9c348cf04aed1070d69c /Lib/test/test_socket.py | |
parent | a4bc2218d270c4c7a898c8b3967c8c271afe9abe (diff) | |
download | cpython-62a6594e66ca955073be2f4e5a40291a39252ef3.zip cpython-62a6594e66ca955073be2f4e5a40291a39252ef3.tar.gz cpython-62a6594e66ca955073be2f4e5a40291a39252ef3.tar.bz2 |
bpo-40066: [Enum] fix tests (GH-30643)
- skip doctest that changes depending on target system
- skip doctest that only fails on CI
- substitute in values that change depending on target system
Diffstat (limited to 'Lib/test/test_socket.py')
-rwxr-xr-x | Lib/test/test_socket.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index 56cc23d..53aa5e9 100755 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -1517,11 +1517,11 @@ class GeneralModuleTests(unittest.TestCase): infos = socket.getaddrinfo(HOST, 80, socket.AF_INET, socket.SOCK_STREAM) for family, type, _, _, _ in infos: self.assertEqual(family, socket.AF_INET) - self.assertEqual(repr(family), '<AddressFamily.AF_INET: 2>') - self.assertEqual(str(family), '2') + self.assertEqual(repr(family), '<AddressFamily.AF_INET: %r>' % family.value) + self.assertEqual(str(family), str(family.value)) self.assertEqual(type, socket.SOCK_STREAM) - self.assertEqual(repr(type), '<SocketKind.SOCK_STREAM: 1>') - self.assertEqual(str(type), '1') + self.assertEqual(repr(type), '<SocketKind.SOCK_STREAM: %r>' % type.value) + self.assertEqual(str(type), str(type.value)) infos = socket.getaddrinfo(HOST, None, 0, socket.SOCK_STREAM) for _, socktype, _, _, _ in infos: self.assertEqual(socktype, socket.SOCK_STREAM) @@ -1795,10 +1795,10 @@ class GeneralModuleTests(unittest.TestCase): # Make sure that the AF_* and SOCK_* constants have enum-like string # reprs. with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: - self.assertEqual(repr(s.family), '<AddressFamily.AF_INET: 2>') - self.assertEqual(repr(s.type), '<SocketKind.SOCK_STREAM: 1>') - self.assertEqual(str(s.family), '2') - self.assertEqual(str(s.type), '1') + self.assertEqual(repr(s.family), '<AddressFamily.AF_INET: %r>' % s.family.value) + self.assertEqual(repr(s.type), '<SocketKind.SOCK_STREAM: %r>' % s.type.value) + self.assertEqual(str(s.family), str(s.family.value)) + self.assertEqual(str(s.type), str(s.type.value)) def test_socket_consistent_sock_type(self): SOCK_NONBLOCK = getattr(socket, 'SOCK_NONBLOCK', 0) |