gh-71339: Use new assertion methods in tests (GH-129046)

This commit is contained in:
Serhiy Storchaka 2025-05-22 13:17:22 +03:00 committed by GitHub
parent bb244fd33d
commit 2602d8ae98
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)