[Python-checkins] python/dist/src/Lib/test test_time.py,1.17,1.18

fdrake at users.sourceforge.net fdrake at users.sourceforge.net
Tue Aug 3 19:58:56 CEST 2004


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7177/Lib/test

Modified Files:
	test_time.py 
Log Message:
allow ctime(), gmtime(), and localtime() to take None as equivalent to an omitted arg
(closes SF bug #658254, patch #663482)


Index: test_time.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_time.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** test_time.py	20 Jun 2004 02:50:15 -0000	1.17
--- test_time.py	3 Aug 2004 17:58:54 -0000	1.18
***************
*** 186,189 ****
--- 186,206 ----
                  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)



More information about the Python-checkins mailing list