Issue #21068: The ssl.PROTOCOL* constants are now enum members.

This commit is contained in:
Antoine Pitrou 2014-04-18 20:33:08 +02:00
parent 1226db4651
commit 172f025bed
3 changed files with 18 additions and 19 deletions

View file

@ -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: