[Python-checkins] CVS: python/nondist/sandbox/datetime test_datetime.py,1.22,1.23

Tim Peters tim_one@users.sourceforge.net
Sun, 03 Mar 2002 17:24:52 -0800


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

Modified Files:
	test_datetime.py 
Log Message:
test_bad_constructor_arguments():  add tests for bad microsecond and
tzoffset arguments.


Index: test_datetime.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_datetime.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** test_datetime.py	4 Mar 2002 01:18:12 -0000	1.22
--- test_datetime.py	4 Mar 2002 01:24:50 -0000	1.23
***************
*** 114,117 ****
--- 114,128 ----
          self.assertRaises(ValueError, datetime, 2000, 1, 31, 23, 59, -1)
          self.assertRaises(ValueError, datetime, 2000, 1, 31, 23, 59, 60)
+         # bad microseconds
+         datetime(2000, 1, 31, 23, 59, 59, 0)    # no exception
+         datetime(2000, 1, 31, 23, 59, 59, 999999)   # no exception
+         self.assertRaises(ValueError, datetime, 2000, 1, 31, 23, 59, 59, -1)
+         self.assertRaises(ValueError, datetime, 2000, 1, 31, 23, 59, 59,
+                           1000000)
+         # bad tzoffet
+         datetime(2, 1, 1, 0, 0, 0, 0, -1439)    # no exception
+         datetime(2, 1, 1, 0, 0, 0, 0,  1439)   # no exception
+         self.assertRaises(ValueError, datetime, 2, 1, 1, 0, 0, 0, 0, -1440)
+         self.assertRaises(ValueError, datetime, 2, 1, 1, 0, 0, 0, 0,  1440)
  
      def test_hash_equality(self):