[Python-checkins] python/dist/src/Lib/test test_datetime.py,1.40,1.41

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Mon, 14 Apr 2003 15:02:01 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv28774/Lib/test

Modified Files:
	test_datetime.py 
Log Message:
The date class is now properly subclassable.  (SF bug #720908)

(This is only the tip of the iceberg; the time and datetime classes
need the same treatment.)


Index: test_datetime.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_datetime.py,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -d -r1.40 -r1.41
*** test_datetime.py	19 Feb 2003 02:35:05 -0000	1.40
--- test_datetime.py	14 Apr 2003 22:01:58 -0000	1.41
***************
*** 480,483 ****
--- 480,489 ----
          self.assertEqual(dt2, dt - days)
  
+     def test_subclass_date(self):
+         class C(date):
+             theAnswer = 42
+         dt = C(2003, 4, 14)
+         self.assertEqual(dt.__class__, C)
+ 
  class TestDate(HarmlessMixedComparison):
      # Tests here should pass for both dates and datetimes, except for a