[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:
Miss Islington (bot) 2025-05-22 12:42:50 +02:00 committed by GitHub
parent d5f7e80d44
commit db98e0bb12
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
117 changed files with 407 additions and 445 deletions

View file

@ -42,7 +42,7 @@ def test_repr(self):
# os.stat() gives a complicated struct sequence.
st = os.stat(__file__)
rep = repr(st)
self.assertTrue(rep.startswith("os.stat_result"))
self.assertStartsWith(rep, "os.stat_result")
self.assertIn("st_mode=", rep)
self.assertIn("st_ino=", rep)
self.assertIn("st_dev=", rep)
@ -307,7 +307,7 @@ def test_copy_replace_with_invisible_fields(self):
self.assertEqual(t5.tm_mon, 2)
# named invisible fields
self.assertTrue(hasattr(t, 'tm_zone'), f"{t} has no attribute 'tm_zone'")
self.assertHasAttr(t, 'tm_zone')
with self.assertRaisesRegex(AttributeError, 'readonly attribute'):
t.tm_zone = 'some other zone'
self.assertEqual(t2.tm_zone, t.tm_zone)