summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2004-08-03 17:58:55 (GMT)
committerFred Drake <fdrake@acm.org>2004-08-03 17:58:55 (GMT)
commitf901abdd62c9067f993b85392dbb73a560af6325 (patch)
tree70cedeab8d5d6b1999a7bfcbd1bb0045c9aa0b90 /Lib/test
parentd04573fef0346ee9a131e0c63d18ab9fbd12ea63 (diff)
downloadcpython-f901abdd62c9067f993b85392dbb73a560af6325.zip
cpython-f901abdd62c9067f993b85392dbb73a560af6325.tar.gz
cpython-f901abdd62c9067f993b85392dbb73a560af6325.tar.bz2
allow ctime(), gmtime(), and localtime() to take None as equivalent to an omitted arg
(closes SF bug #658254, patch #663482)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_time.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py
index 64f1f01..768e7a0 100644
--- a/Lib/test/test_time.py
+++ b/Lib/test/test_time.py
@@ -185,6 +185,23 @@ class TimeTestCase(unittest.TestCase):
for unreasonable in -1e200, 1e200:
self.assertRaises(ValueError, func, unreasonable)
+ def test_ctime_without_arg(self):
+ # Not sure how to check the values, since the clock could tick
+ # at any time. Make sure these are at least accepted and
+ # don't raise errors.
+ time.ctime()
+ time.ctime(None)
+
+ def test_gmtime_without_arg(self):
+ t0 = time.mktime(time.gmtime())
+ t1 = time.mktime(time.gmtime(None))
+ self.assert_(0 <= (t1-t0) < 0.2)
+
+ def test_localtime_without_arg(self):
+ t0 = time.mktime(time.localtime())
+ t1 = time.mktime(time.localtime(None))
+ self.assert_(0 <= (t1-t0) < 0.2)
+
def test_main():
test_support.run_unittest(TimeTestCase)