diff options
Diffstat (limited to 'Lib/test/test_time.py')
-rw-r--r-- | Lib/test/test_time.py | 48 |
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): |