[Python-checkins] python/dist/src/Lib/test test_strptime.py,1.7,1.8

nnorwitz@users.sourceforge.net nnorwitz@users.sourceforge.net
2002年12月26日 08:19:54 -0800


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv2045/Lib/test
Modified Files:
	test_strptime.py 
Log Message:
Fix julian day problem with strptime. Note: XXX about using 0, suggestions?
Index: test_strptime.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strptime.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** test_strptime.py	27 Nov 2002 08:30:25 -0000	1.7
--- test_strptime.py	26 Dec 2002 16:19:52 -0000	1.8
***************
*** 380,383 ****
--- 380,394 ----
 
 
+ class JulianTests(unittest.TestCase):
+ """Test a _strptime regression that all julian (1-366) are accepted"""
+ 
+ def test_all_julian_days(self):
+ eq = self.assertEqual
+ # XXX: should 0 be accepted?
+ for i in range(1, 367):
+ # use 2004, since it is a leap year, we have 366 days
+ eq(_strptime.strptime('%d 2004' % i, '%j %Y')[7], i)
+ 
+ 
 def test_main():
 suite = unittest.TestSuite()
***************
*** 387,390 ****
--- 398,402 ----
 suite.addTest(unittest.makeSuite(FxnTests))
 suite.addTest(unittest.makeSuite(Strptime12AMPMTests))
+ suite.addTest(unittest.makeSuite(JulianTests))
 test_support.run_suite(suite)
 

AltStyle によって変換されたページ (->オリジナル) /