[Python-checkins] python/nondist/sandbox/datetime obj_datetimetz.c,1.11,1.12 test_both.py,1.78,1.79 test_datetime.py,1.67,1.68

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
Fri, 13 Dec 2002 22:38:12 -0800


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

Modified Files:
	obj_datetimetz.c test_both.py test_datetime.py 
Log Message:
Moved all remaining datetimetz tests from test_datetime.py to test_both.py.
Given how much of the C datetimetz implementation is still non-functional,
that's pretty amazing.


Index: obj_datetimetz.c
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/datetime/obj_datetimetz.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** obj_datetimetz.c	14 Dec 2002 06:31:58 -0000	1.11
--- obj_datetimetz.c	14 Dec 2002 06:38:09 -0000	1.12
***************
*** 409,426 ****
  
  static PyObject *
! datetimetz_getdate(PyDateTime_DateTimeTZ *self)
! {
! 	return new_date(GET_YEAR(self),
! 			GET_MONTH(self),
! 			GET_DAY(self));
! }
! 
! static PyObject *
! datetimetz_gettime(PyDateTime_DateTimeTZ *self)
  {
! 	return new_time(DATE_GET_HOUR(self),
! 			DATE_GET_MINUTE(self),
! 			DATE_GET_SECOND(self),
! 			DATE_GET_MICROSECOND(self));
  }
  
--- 409,419 ----
  
  static PyObject *
! datetimetz_gettimetz(PyDateTime_DateTimeTZ *self)
  {
! 	return new_timetz(DATE_GET_HOUR(self),
! 			  DATE_GET_MINUTE(self),
! 			  DATE_GET_SECOND(self),
! 			  DATE_GET_MICROSECOND(self),
! 			  self->tzinfo);
  }
  
***************
*** 545,557 ****
  
  	/* Instance methods: */
  	{"timetuple",   (PyCFunction)datetimetz_timetuple, METH_NOARGS,
           PyDoc_STR("Return time tuple, compatible with time.localtime().")},
  
! 	{"date",   (PyCFunction)datetimetz_getdate, METH_NOARGS,
!          PyDoc_STR("Return date object with same year, month and day.")},
! 
! 	{"time",   (PyCFunction)datetimetz_gettime, METH_NOARGS,
!          PyDoc_STR("Return time object with same hour, minute, second and "
!          	   "microsecond.")},
  
  	{"ctime",       (PyCFunction)datetimetz_ctime,	METH_NOARGS,
--- 538,548 ----
  
  	/* Instance methods: */
+ 	/* Inherited:  date(), time(). */
  	{"timetuple",   (PyCFunction)datetimetz_timetuple, METH_NOARGS,
           PyDoc_STR("Return time tuple, compatible with time.localtime().")},
  
! 	{"timetz",   (PyCFunction)datetimetz_gettimetz, METH_NOARGS,
!          PyDoc_STR("Return timetz object with same hour, minute, second, "
!          	   "microsecond, and tzinfo.")},
  
  	{"ctime",       (PyCFunction)datetimetz_ctime,	METH_NOARGS,

Index: test_both.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_both.py,v
retrieving revision 1.78
retrieving revision 1.79
diff -C2 -d -r1.78 -r1.79
*** test_both.py	14 Dec 2002 05:45:49 -0000	1.78
--- test_both.py	14 Dec 2002 06:38:09 -0000	1.79
***************
*** 1932,1935 ****
--- 1932,1950 ----
                           d + "datetimetz(2002, 3, 19, 13, 47, tzinfo=met)")
  
+     def test_combine(self):
+         met = FixedOffset(60, "MET")
+         d = date(2002, 3, 4)
+         tz = timetz(18, 45, 3, 1234, tzinfo=met)
+         dt = datetimetz.combine(d, tz)
+         self.assertEqual(dt, datetimetz(2002, 3, 4, 18, 45, 3, 1234,
+                                         tzinfo=met))
+ 
+     def test_extract(self):
+         met = FixedOffset(60, "MET")
+         dt = self.theclass(2002, 3, 4, 18, 45, 3, 1234, tzinfo=met)
+         self.assertEqual(dt.date(), date(2002, 3, 4))
+         self.assertEqual(dt.time(), time(18, 45, 3, 1234))
+         self.assertEqual(dt.timetz(), timetz(18, 45, 3, 1234, tzinfo=met))
+ 
  
  def test_suite():

Index: test_datetime.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_datetime.py,v
retrieving revision 1.67
retrieving revision 1.68
diff -C2 -d -r1.67 -r1.68
*** test_datetime.py	14 Dec 2002 05:45:49 -0000	1.67
--- test_datetime.py	14 Dec 2002 06:38:10 -0000	1.68
***************
*** 71,101 ****
  
  
- class TestDateTimeTZ(TestDateTime):
- 
-     theclass = datetimetz
- 
-     # XXX Most of the tests here have moved into test_both.py.
- 
-     def test_combine(self):
-         met = FixedOffset(60, "MET")
-         d = date(2002, 3, 4)
-         tz = timetz(18, 45, 3, 1234, tzinfo=met)
-         dt = datetimetz.combine(d, tz)
-         self.assertEqual(dt, datetimetz(2002, 3, 4, 18, 45, 3, 1234,
-                                         tzinfo=met))
- 
-     def test_extract(self):
-         met = FixedOffset(60, "MET")
-         dt = self.theclass(2002, 3, 4, 18, 45, 3, 1234, tzinfo=met)
-         self.assertEqual(dt.date(), date(2002, 3, 4))
-         self.assertEqual(dt.time(), time(18, 45, 3, 1234))
-         self.assertEqual(dt.timetz(), timetz(18, 45, 3, 1234, tzinfo=met))
- 
- 
  def test_suite():
      s4 = unittest.makeSuite(TestTimeTZ, 'test')
      s5 = unittest.makeSuite(TestDateTime, 'test')
!     s6 = unittest.makeSuite(TestDateTimeTZ, 'test')
!     return unittest.TestSuite([s4, s5, s6])
  
  def test_main():
--- 71,78 ----
  
  
  def test_suite():
      s4 = unittest.makeSuite(TestTimeTZ, 'test')
      s5 = unittest.makeSuite(TestDateTime, 'test')
!     return unittest.TestSuite([s4, s5])
  
  def test_main():