From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Fri, 29 Mar 2024 01:19:04 +0000 (+0100) Subject: [3.12] Fix reversed assertRegex checks in test_ssl. (GH-117351) (#117359) X-Git-Tag: v3.12.3~22 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2a18945dc6e1c6e4daf55ec5a3aa07679df1cb1d;p=thirdparty%2FPython%2Fcpython.git [3.12] Fix reversed assertRegex checks in test_ssl. (GH-117351) (#117359) Fix reversed assertRegex checks in test_ssl. (GH-117351) (cherry picked from commit 2e9be80c99f635c2f7761e8356b0260922d6e7a6) Co-authored-by: Gregory P. Smith --- diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index f3960be2785f..9b59ddd887aa 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -3822,7 +3822,7 @@ class ThreadedTests(unittest.TestCase): 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): @@ -4137,7 +4137,7 @@ class ThreadedTests(unittest.TestCase): # 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):