summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_time.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2025-05-22 10:42:50 (GMT)
committerGitHub <noreply@github.com>2025-05-22 10:42:50 (GMT)
commitdb98e0bb127c469842dc119d23e5daacd23862cc (patch)
tree5628e04625c93f2e5bde25aa29dedb3c154a0dec /Lib/test/test_time.py
parentd5f7e80d4407655919b32bbd5746b23af174bc5b (diff)
downloadcpython-db98e0bb127c469842dc119d23e5daacd23862cc.zip
cpython-db98e0bb127c469842dc119d23e5daacd23862cc.tar.gz
cpython-db98e0bb127c469842dc119d23e5daacd23862cc.tar.bz2
[3.14] gh-71339: Use new assertion methods in tests (GH-129046) (GH-134498)
(cherry picked from commit 2602d8ae981c4bae1cada2c174b367d97f712efb) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Lib/test/test_time.py')
-rw-r--r--Lib/test/test_time.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py
index d06f652..5312faa 100644
--- a/Lib/test/test_time.py
+++ b/Lib/test/test_time.py
@@ -761,17 +761,17 @@ class TestPytime(unittest.TestCase):
# Get the localtime and examine it for the offset and zone.
lt = time.localtime()
- self.assertTrue(hasattr(lt, "tm_gmtoff"))
- self.assertTrue(hasattr(lt, "tm_zone"))
+ self.assertHasAttr(lt, "tm_gmtoff")
+ self.assertHasAttr(lt, "tm_zone")
# See if the offset and zone are similar to the module
# attributes.
if lt.tm_gmtoff is None:
- self.assertTrue(not hasattr(time, "timezone"))
+ self.assertNotHasAttr(time, "timezone")
else:
self.assertEqual(lt.tm_gmtoff, -[time.timezone, time.altzone][lt.tm_isdst])
if lt.tm_zone is None:
- self.assertTrue(not hasattr(time, "tzname"))
+ self.assertNotHasAttr(time, "tzname")
else:
self.assertEqual(lt.tm_zone, time.tzname[lt.tm_isdst])
@@ -1184,11 +1184,11 @@ class TestTimeWeaklinking(unittest.TestCase):
if mac_ver >= (10, 12):
for name in clock_names:
- self.assertTrue(hasattr(time, name), f"time.{name} is not available")
+ self.assertHasAttr(time, name)
else:
for name in clock_names:
- self.assertFalse(hasattr(time, name), f"time.{name} is available")
+ self.assertNotHasAttr(time, name)
if __name__ == "__main__":