mirror of
https://github.com/python/cpython.git
synced 2025-11-01 14:11:41 +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
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue