summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_time.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-06-30 23:06:06 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-06-30 23:06:06 (GMT)
commitc9c0f201fed21efcf669dbbf5f923eaf0eeb1db9 (patch)
tree6350dab0b481e6de307dc4e043c6230f463a9ca7 /Lib/test/test_time.py
parent98d23f2e065713ccfbc07d9a0b65f737a212bfb5 (diff)
downloadcpython-c9c0f201fed21efcf669dbbf5f923eaf0eeb1db9.zip
cpython-c9c0f201fed21efcf669dbbf5f923eaf0eeb1db9.tar.gz
cpython-c9c0f201fed21efcf669dbbf5f923eaf0eeb1db9.tar.bz2
convert old fail* assertions to assert*
Diffstat (limited to 'Lib/test/test_time.py')
-rw-r--r--Lib/test/test_time.py48
1 files changed, 24 insertions, 24 deletions
diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py
index 93d4d36..49a9d17 100644
--- a/Lib/test/test_time.py
+++ b/Lib/test/test_time.py
@@ -18,9 +18,9 @@ class TimeTestCase(unittest.TestCase):
time.clock()
def test_conversions(self):
- self.assert_(time.ctime(self.t)
+ self.assertTrue(time.ctime(self.t)
== time.asctime(time.localtime(self.t)))
- self.assert_(int(time.mktime(time.localtime(self.t)))
+ self.assertTrue(int(time.mktime(time.localtime(self.t)))
== int(self.t))
def test_sleep(self):
@@ -153,36 +153,36 @@ class TimeTestCase(unittest.TestCase):
time.tzset()
environ['TZ'] = utc
time.tzset()
- self.failUnlessEqual(
+ self.assertEqual(
time.gmtime(xmas2002), time.localtime(xmas2002)
)
- self.failUnlessEqual(time.daylight, 0)
- self.failUnlessEqual(time.timezone, 0)
- self.failUnlessEqual(time.localtime(xmas2002).tm_isdst, 0)
+ self.assertEqual(time.daylight, 0)
+ self.assertEqual(time.timezone, 0)
+ self.assertEqual(time.localtime(xmas2002).tm_isdst, 0)
# Make sure we can switch to US/Eastern
environ['TZ'] = eastern
time.tzset()
- self.failIfEqual(time.gmtime(xmas2002), time.localtime(xmas2002))
- self.failUnlessEqual(time.tzname, ('EST', 'EDT'))
- self.failUnlessEqual(len(time.tzname), 2)
- self.failUnlessEqual(time.daylight, 1)
- self.failUnlessEqual(time.timezone, 18000)
- self.failUnlessEqual(time.altzone, 14400)
- self.failUnlessEqual(time.localtime(xmas2002).tm_isdst, 0)
- self.failUnlessEqual(len(time.tzname), 2)
+ self.assertNotEqual(time.gmtime(xmas2002), time.localtime(xmas2002))
+ self.assertEqual(time.tzname, ('EST', 'EDT'))
+ self.assertEqual(len(time.tzname), 2)
+ self.assertEqual(time.daylight, 1)
+ self.assertEqual(time.timezone, 18000)
+ self.assertEqual(time.altzone, 14400)
+ self.assertEqual(time.localtime(xmas2002).tm_isdst, 0)
+ self.assertEqual(len(time.tzname), 2)
# Now go to the southern hemisphere.
environ['TZ'] = victoria
time.tzset()
- self.failIfEqual(time.gmtime(xmas2002), time.localtime(xmas2002))
- self.failUnless(time.tzname[0] == 'AEST', str(time.tzname[0]))
- self.failUnless(time.tzname[1] == 'AEDT', str(time.tzname[1]))
- self.failUnlessEqual(len(time.tzname), 2)
- self.failUnlessEqual(time.daylight, 1)
- self.failUnlessEqual(time.timezone, -36000)
- self.failUnlessEqual(time.altzone, -39600)
- self.failUnlessEqual(time.localtime(xmas2002).tm_isdst, 1)
+ self.assertNotEqual(time.gmtime(xmas2002), time.localtime(xmas2002))
+ self.assertTrue(time.tzname[0] == 'AEST', str(time.tzname[0]))
+ self.assertTrue(time.tzname[1] == 'AEDT', str(time.tzname[1]))
+ self.assertEqual(len(time.tzname), 2)
+ self.assertEqual(time.daylight, 1)
+ self.assertEqual(time.timezone, -36000)
+ self.assertEqual(time.altzone, -39600)
+ self.assertEqual(time.localtime(xmas2002).tm_isdst, 1)
finally:
# Repair TZ environment variable in case any other tests
@@ -214,14 +214,14 @@ class TimeTestCase(unittest.TestCase):
gt1 = time.gmtime(None)
t0 = time.mktime(gt0)
t1 = time.mktime(gt1)
- self.assert_(0 <= (t1-t0) < 0.2)
+ self.assertTrue(0 <= (t1-t0) < 0.2)
def test_localtime_without_arg(self):
lt0 = time.localtime()
lt1 = time.localtime(None)
t0 = time.mktime(lt0)
t1 = time.mktime(lt1)
- self.assert_(0 <= (t1-t0) < 0.2)
+ self.assertTrue(0 <= (t1-t0) < 0.2)
class TestLocale(unittest.TestCase):
def setUp(self):