mirror of
https://github.com/python/cpython.git
synced 2025-11-01 22:21:35 +00:00
gh-71339: Use new assertion methods in tests (GH-129046)
This commit is contained in:
parent
bb244fd33d
commit
2602d8ae98
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