diff options
author | Nikita Sobolev <mail@sobolevn.me> | 2021-09-15 16:57:03 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-15 16:57:03 (GMT) |
commit | d897579a80da3f4572d96501c41bec6cacb10d84 (patch) | |
tree | db79bdbbebb387b5dbf07f49b4847096cdf98ab5 /Lib | |
parent | cbeb81971057d6c382f45ecce92df2b204d4106a (diff) | |
download | cpython-d897579a80da3f4572d96501c41bec6cacb10d84.zip cpython-d897579a80da3f4572d96501c41bec6cacb10d84.tar.gz cpython-d897579a80da3f4572d96501c41bec6cacb10d84.tar.bz2 |
bpo-45185: enables `TestEnumerations` in `test_ssl` (GH-28330)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_ssl.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index d9e1843..556c1cf 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -4969,17 +4969,18 @@ class TestEnumerations(unittest.TestCase): lambda name: name.startswith('PROTOCOL_') and name != 'PROTOCOL_SSLv23', source=ssl._ssl, ) + # This member is assigned dynamically in `ssl.py`: + Checked_SSLMethod.PROTOCOL_SSLv23 = Checked_SSLMethod.PROTOCOL_TLS enum._test_simple_enum(Checked_SSLMethod, ssl._SSLMethod) def test_options(self): CheckedOptions = enum._old_convert_( - enum.FlagEnum, 'Options', 'ssl', + enum.IntFlag, 'Options', 'ssl', lambda name: name.startswith('OP_'), source=ssl._ssl, ) enum._test_simple_enum(CheckedOptions, ssl.Options) - def test_alertdescription(self): CheckedAlertDescription = enum._old_convert_( enum.IntEnum, 'AlertDescription', 'ssl', @@ -4989,16 +4990,16 @@ class TestEnumerations(unittest.TestCase): enum._test_simple_enum(CheckedAlertDescription, ssl.AlertDescription) def test_sslerrornumber(self): - Checked_SSLMethod = enum._old_convert_( - enum.IntEnum, '_SSLMethod', 'ssl', - lambda name: name.startswith('PROTOCOL_') and name != 'PROTOCOL_SSLv23', + Checked_SSLErrorNumber = enum._old_convert_( + enum.IntEnum, 'SSLErrorNumber', 'ssl', + lambda name: name.startswith('SSL_ERROR_'), source=ssl._ssl, ) - enum._test_simple_enum(Checked_SSLMethod, ssl._SSLMethod) + enum._test_simple_enum(Checked_SSLErrorNumber, ssl.SSLErrorNumber) def test_verifyflags(self): CheckedVerifyFlags = enum._old_convert_( - enum.FlagEnum, 'VerifyFlags', 'ssl', + enum.IntFlag, 'VerifyFlags', 'ssl', lambda name: name.startswith('VERIFY_'), source=ssl._ssl, ) @@ -5012,6 +5013,7 @@ class TestEnumerations(unittest.TestCase): ) enum._test_simple_enum(CheckedVerifyMode, ssl.VerifyMode) + def test_main(verbose=False): if support.verbose: plats = { @@ -5046,7 +5048,7 @@ def test_main(verbose=False): tests = [ ContextTests, BasicSocketTests, SSLErrorTests, MemoryBIOTests, SSLObjectTests, SimpleBackgroundTests, ThreadedTests, - TestPostHandshakeAuth, TestSSLDebug + TestPostHandshakeAuth, TestSSLDebug, TestEnumerations, ] if support.is_resource_enabled('network'): |