Revert "bpo-40066: [Enum] update str() and format() output (GH-30582)" (GH-30632)

This reverts commit acf7403f9b.
This commit is contained in:
Victor Stinner 2022-01-17 13:58:40 +01:00 committed by GitHub
parent 7f4b69b907
commit 42a64c03ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 2021 additions and 2087 deletions

View file

@ -373,8 +373,7 @@ class BasicSocketTests(unittest.TestCase):
# Make sure that the PROTOCOL_* constants have enum-like string
# reprs.
proto = ssl.PROTOCOL_TLS_CLIENT
self.assertEqual(repr(proto), '<_SSLMethod.PROTOCOL_TLS_CLIENT: 16>')
self.assertEqual(str(proto), '16')
self.assertEqual(str(proto), 'PROTOCOL_TLS_CLIENT')
ctx = ssl.SSLContext(proto)
self.assertIs(ctx.protocol, proto)
@ -623,7 +622,7 @@ class BasicSocketTests(unittest.TestCase):
with self.assertWarns(DeprecationWarning) as cm:
ssl.SSLContext(protocol)
self.assertEqual(
f'ssl.{protocol.name} is deprecated',
f'{protocol!r} is deprecated',
str(cm.warning)
)
@ -632,9 +631,8 @@ class BasicSocketTests(unittest.TestCase):
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
with self.assertWarns(DeprecationWarning) as cm:
ctx.minimum_version = version
version_text = '%s.%s' % (version.__class__.__name__, version.name)
self.assertEqual(
f'ssl.{version_text} is deprecated',
f'ssl.{version!r} is deprecated',
str(cm.warning)
)