summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_socket.py
diff options
context:
space:
mode:
authorEthan Furman <ethan@stoneleaf.us>2021-03-31 04:17:26 (GMT)
committerGitHub <noreply@github.com>2021-03-31 04:17:26 (GMT)
commitb775106d940e3d77c8af7967545bb9a5b7b162df (patch)
treea5146740d7fab61a70bf410e4f348a9525cb1fd4 /Lib/test/test_socket.py
parent51a85ddce8b336addcb61b96f04c9c5edef07296 (diff)
downloadcpython-b775106d940e3d77c8af7967545bb9a5b7b162df.zip
cpython-b775106d940e3d77c8af7967545bb9a5b7b162df.tar.gz
cpython-b775106d940e3d77c8af7967545bb9a5b7b162df.tar.bz2
bpo-40066: Enum: modify `repr()` and `str()` (GH-22392)
* Enum: streamline repr() and str(); improve docs - repr() is now ``enum_class.member_name`` - stdlib global enums are ``module_name.member_name`` - str() is now ``member_name`` - add HOW-TO section for ``Enum`` - change main documentation to be an API reference
Diffstat (limited to 'Lib/test/test_socket.py')
-rwxr-xr-xLib/test/test_socket.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index bc28030..f91e000 100755
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -1518,9 +1518,9 @@ 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(str(family), 'AddressFamily.AF_INET')
+ self.assertEqual(str(family), 'AF_INET')
self.assertEqual(type, socket.SOCK_STREAM)
- self.assertEqual(str(type), 'SocketKind.SOCK_STREAM')
+ self.assertEqual(str(type), 'SOCK_STREAM')
infos = socket.getaddrinfo(HOST, None, 0, socket.SOCK_STREAM)
for _, socktype, _, _, _ in infos:
self.assertEqual(socktype, socket.SOCK_STREAM)
@@ -1793,8 +1793,8 @@ 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(str(s.family), 'AddressFamily.AF_INET')
- self.assertEqual(str(s.type), 'SocketKind.SOCK_STREAM')
+ self.assertEqual(str(s.family), 'AF_INET')
+ self.assertEqual(str(s.type), 'SOCK_STREAM')
def test_socket_consistent_sock_type(self):
SOCK_NONBLOCK = getattr(socket, 'SOCK_NONBLOCK', 0)