summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_ssl.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2014-04-18 18:33:08 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2014-04-18 18:33:08 (GMT)
commit172f025bed3cca992c1d4d9fe93d4cd8bee92392 (patch)
treecfed69633555d4a905faa1f4da90fbfcdc63b5a2 /Lib/test/test_ssl.py
parent1226db46517f21cba52bd3efe8b206ddaefd7504 (diff)
downloadcpython-172f025bed3cca992c1d4d9fe93d4cd8bee92392.zip
cpython-172f025bed3cca992c1d4d9fe93d4cd8bee92392.tar.gz
cpython-172f025bed3cca992c1d4d9fe93d4cd8bee92392.tar.bz2
Issue #21068: The ssl.PROTOCOL* constants are now enum members.
Diffstat (limited to 'Lib/test/test_ssl.py')
-rw-r--r--Lib/test/test_ssl.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
index 9f5bd09..a2ab795 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -134,6 +134,14 @@ class BasicSocketTests(unittest.TestCase):
self.assertIn(ssl.HAS_SNI, {True, False})
self.assertIn(ssl.HAS_ECDH, {True, False})
+ def test_str_for_enums(self):
+ # Make sure that the PROTOCOL_* constants have enum-like string
+ # reprs.
+ proto = ssl.PROTOCOL_SSLv3
+ self.assertEqual(str(proto), '_SSLMethod.PROTOCOL_SSLv3')
+ ctx = ssl.SSLContext(proto)
+ self.assertIs(ctx.protocol, proto)
+
def test_random(self):
v = ssl.RAND_status()
if support.verbose: