[Python-checkins] python/nondist/sandbox/datetime doc.txt,1.30,1.31 test_both.py,1.54,1.55

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
2002年12月08日 11:21:34 -0800


Update of /cvsroot/python/python/nondist/sandbox/datetime
In directory sc8-pr-cvs1:/tmp/cvs-serv16211
Modified Files:
	doc.txt test_both.py 
Log Message:
Noted the obvious invariant among datetime.combine(), d.date() and
d.time(), and added some test lines to verify it.
Index: doc.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/datetime/doc.txt,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** doc.txt	8 Dec 2002 19:02:30 -0000	1.30
--- doc.txt	8 Dec 2002 19:21:32 -0000	1.31
***************
*** 400,404 ****
 Return a new datetime object whose date components are equal to the
 given date object's, and whose time components are equal to the given
! time object's.
 
 Class attributes:
--- 400,405 ----
 Return a new datetime object whose date components are equal to the
 given date object's, and whose time components are equal to the given
! time object's. For any datetime object d,
! d == datetime.combine(d.date(), d.time()).
 
 Class attributes:
Index: test_both.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_both.py,v
retrieving revision 1.54
retrieving revision 1.55
diff -C2 -d -r1.54 -r1.55
*** test_both.py	7 Dec 2002 21:06:38 -0000	1.54
--- test_both.py	8 Dec 2002 19:21:32 -0000	1.55
***************
*** 1138,1143 ****
--- 1138,1148 ----
 dt = combine(d, t)
 self.assertEqual(dt, expected)
+ 
 dt = combine(time=t, date=d)
 self.assertEqual(dt, expected)
+ 
+ self.assertEqual(d, dt.date())
+ self.assertEqual(t, dt.time())
+ self.assertEqual(dt, combine(dt.date(), dt.time()))
 
 self.assertRaises(TypeError, combine) # need an arg

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