mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
[3.14] gh-71339: Use new assertion methods in tests (GH-129046) (GH-134498)
(cherry picked from commit 2602d8ae98
)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
d5f7e80d44
commit
db98e0bb12
117 changed files with 407 additions and 445 deletions
|
@ -539,9 +539,9 @@ class BasicSocketTests(unittest.TestCase):
|
|||
openssl_ver = f"OpenSSL {major:d}.{minor:d}.{patch:d}"
|
||||
else:
|
||||
openssl_ver = f"OpenSSL {major:d}.{minor:d}.{fix:d}"
|
||||
self.assertTrue(
|
||||
s.startswith((openssl_ver, libressl_ver, "AWS-LC")),
|
||||
(s, t, hex(n))
|
||||
self.assertStartsWith(
|
||||
s, (openssl_ver, libressl_ver, "AWS-LC"),
|
||||
(t, hex(n))
|
||||
)
|
||||
|
||||
@support.cpython_only
|
||||
|
@ -1668,7 +1668,7 @@ class SSLErrorTests(unittest.TestCase):
|
|||
regex = "(NO_START_LINE|UNSUPPORTED_PUBLIC_KEY_TYPE)"
|
||||
self.assertRegex(cm.exception.reason, regex)
|
||||
s = str(cm.exception)
|
||||
self.assertTrue("NO_START_LINE" in s, s)
|
||||
self.assertIn("NO_START_LINE", s)
|
||||
|
||||
def test_subclass(self):
|
||||
# Check that the appropriate SSLError subclass is raised
|
||||
|
@ -1683,7 +1683,7 @@ class SSLErrorTests(unittest.TestCase):
|
|||
with self.assertRaises(ssl.SSLWantReadError) as cm:
|
||||
c.do_handshake()
|
||||
s = str(cm.exception)
|
||||
self.assertTrue(s.startswith("The operation did not complete (read)"), s)
|
||||
self.assertStartsWith(s, "The operation did not complete (read)")
|
||||
# For compatibility
|
||||
self.assertEqual(cm.exception.errno, ssl.SSL_ERROR_WANT_READ)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue