[Python-checkins] python/nondist/sandbox/datetime test_both.py,1.5,1.6 test_cdatetime.py,1.8,1.9 test_datetime.py,1.48,1.49

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
Tue, 26 Nov 2002 09:26:21 -0800


Update of /cvsroot/python/python/nondist/sandbox/datetime
In directory sc8-pr-cvs1:/tmp/cvs-serv27057

Modified Files:
	test_both.py test_cdatetime.py test_datetime.py 
Log Message:
XXX-commented the two tests that still fail in the C implementation.
Began the process of moving datetime tests into test_both.


Index: test_both.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_both.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** test_both.py	26 Nov 2002 17:19:39 -0000	1.5
--- test_both.py	26 Nov 2002 17:26:17 -0000	1.6
***************
*** 55,58 ****
--- 55,59 ----
          self.assertEqual(a*10, timedelta(70))
          self.assertEqual(a*10, 10*a)
+         # XXX Next one fails in the C implementation.
          self.assertEqual(a*10L, 10*a)
          self.assertEqual(b*10, timedelta(0, 600))
***************
*** 332,336 ****
          # 3652058 days, 23 hours, 59 minutes, 59 seconds, 999999 microseconds
          n = (big.days*24*3600 + big.seconds)*1000000 + big.microseconds
!         # n = 315537897599999999 ~= 2**58.13
          justasbig = timedelta(0, 0, n)
          self.assertEqual(big, justasbig)
--- 333,338 ----
          # 3652058 days, 23 hours, 59 minutes, 59 seconds, 999999 microseconds
          n = (big.days*24*3600 + big.seconds)*1000000 + big.microseconds
!         # n == 315537897599999999 ~= 2**58.13
!         # XXX Next line fails in the C implementation.
          justasbig = timedelta(0, 0, n)
          self.assertEqual(big, justasbig)
***************
*** 354,357 ****
--- 356,376 ----
              self.assertEqual(t, (1956, 3, 1+i, 0, 0, 0, (3+i)%7, 61+i, -1))
  
+ #############################################################################
+ # datetime tests
+ 
+ class TestDateTime(unittest.TestCase):
+ 
+     theclass = datetime.datetime
+ 
+     def test_basic_attributes(self):
+         dt = self.theclass(2002, 3, 1, 12, 0)
+         self.assertEqual(dt.year, 2002)
+         self.assertEqual(dt.month, 3)
+         self.assertEqual(dt.day, 1)
+         self.assertEqual(dt.hour, 12)
+         self.assertEqual(dt.minute, 0)
+         self.assertEqual(dt.second, 0)
+         self.assertEqual(dt.microsecond, 0)
+ 
  
  def test_suite():
***************
*** 359,362 ****
--- 378,382 ----
                   for klass in (TestTimeDelta,
                                 TestDate,
+                                TestDateTime,
                                )
                  ]

Index: test_cdatetime.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_cdatetime.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** test_cdatetime.py	26 Nov 2002 06:27:24 -0000	1.8
--- test_cdatetime.py	26 Nov 2002 17:26:18 -0000	1.9
***************
*** 31,44 ****
      theclass = datetime
  
-     def test_basic_attributes(self):
-         dt = self.theclass(2002, 3, 1, 12, 0)
-         self.assertEqual(dt.year, 2002)
-         self.assertEqual(dt.month, 3)
-         self.assertEqual(dt.day, 1)
-         self.assertEqual(dt.hour, 12)
-         self.assertEqual(dt.minute, 0)
-         self.assertEqual(dt.second, 0)
-         self.assertEqual(dt.microsecond, 0)
- 
      def test_basic_attributes_nonzero(self):
          # Make sure all attributes are non-zero so bugs in
--- 31,34 ----

Index: test_datetime.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_datetime.py,v
retrieving revision 1.48
retrieving revision 1.49
diff -C2 -d -r1.48 -r1.49
*** test_datetime.py	26 Nov 2002 05:11:25 -0000	1.48
--- test_datetime.py	26 Nov 2002 17:26:18 -0000	1.49
***************
*** 215,228 ****
      theclass = datetime
  
-     def test_basic_attributes(self):
-         dt = self.theclass(2002, 3, 1, 12, 0, 0)
-         self.assertEqual(dt.year, 2002)
-         self.assertEqual(dt.month, 3)
-         self.assertEqual(dt.day, 1)
-         self.assertEqual(dt.hour, 12)
-         self.assertEqual(dt.minute, 0)
-         self.assertEqual(dt.second, 0)
-         self.assertEqual(dt.microsecond, 0)
- 
      def test_basic_attributes_nonzero(self):
          # Make sure all attributes are non-zero so bugs in
--- 215,218 ----