From b321eb0afc3d6d764e2ee22cbc51aaecd502e6dd Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith [Google LLC]" Date: Thu, 28 Mar 2024 14:49:00 -0700 Subject: [PATCH] Fix reversed assertRegex checks in test_ssl. --- Lib/test/test_ssl.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index bd831ac22419af..794944afd66dd0 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -3867,7 +3867,7 @@ def test_min_max_version_mismatch(self): server_hostname=hostname) as s: with self.assertRaises(ssl.SSLError) as e: s.connect((HOST, server.port)) - self.assertRegex("(alert|ALERT)", str(e.exception)) + self.assertRegex(str(e.exception), "(alert|ALERT)") @requires_tls_version('SSLv3') def test_min_max_version_sslv3(self): @@ -4182,7 +4182,7 @@ def cb_raising(ssl_sock, server_name, initial_context): # Allow for flexible libssl error messages. regex = "(SSLV3_ALERT_HANDSHAKE_FAILURE|NO_PRIVATE_VALUE)" - self.assertRegex(regex, cm.exception.reason) + self.assertRegex(cm.exception.reason, regex) self.assertEqual(catch.unraisable.exc_type, ZeroDivisionError) def test_sni_callback_wrong_return_type(self):