[Python-checkins] r68610 - in python/trunk/Lib/test: test_datetime.py test_os.py

kristjan.jonsson python-checkins at python.org
Thu Jan 15 10:09:13 CET 2009


Author: kristjan.jonsson
Date: Thu Jan 15 10:09:13 2009
New Revision: 68610

Log:
Fix recently introduced test cases.
For datetime, gentoo didn't seem to mind the %e format for strftime.  So, we just excercise those instead making sure that we don't crash.
For test_os, two cases were incorrect.

Modified:
   python/trunk/Lib/test/test_datetime.py
   python/trunk/Lib/test/test_os.py

Modified: python/trunk/Lib/test/test_datetime.py
==============================================================================
--- python/trunk/Lib/test/test_datetime.py	(original)
+++ python/trunk/Lib/test/test_datetime.py	Thu Jan 15 10:09:13 2009
@@ -857,9 +857,18 @@
         self.assertEqual(t.strftime("'%z' '%Z'"), "'' ''")
 
         #make sure that invalid format specifiers are handled correctly
-        self.assertRaises(ValueError, t.strftime, "%e")
-        self.assertRaises(ValueError, t.strftime, "%")
-        self.assertRaises(ValueError, t.strftime, "%#")
+        #self.assertRaises(ValueError, t.strftime, "%e")
+        #self.assertRaises(ValueError, t.strftime, "%")
+        #self.assertRaises(ValueError, t.strftime, "%#")
+
+        #oh well, some systems just ignore those invalid ones.
+        #at least, excercise them to make sure that no crashes
+        #are generated
+        for f in ["%e", "%", "%#"]:
+            try:
+                t.strftime(f)
+            except ValueError:
+                pass
 
         #check that this standard extension works
         t.strftime("%f")

Modified: python/trunk/Lib/test/test_os.py
==============================================================================
--- python/trunk/Lib/test/test_os.py	(original)
+++ python/trunk/Lib/test/test_os.py	Thu Jan 15 10:09:13 2009
@@ -559,11 +559,11 @@
 
     def test_fchown(self):
         if hasattr(os, "fchown"):
-            self.assertRaises(OSError, os.fchmod, 10, -1, -1)
+            self.assertRaises(OSError, os.fchown, 10, -1, -1)
 
     def test_fpathconf(self):
         if hasattr(os, "fpathconf"):
-            self.assertRaises(OSError, os.fpathconf, 10, "foo")
+            self.assertRaises(OSError, os.fpathconf, 10, "PC_FILESIZEBITS")
 
     def test_ftruncate(self):
         if hasattr(os, "ftruncate"):


More information about the Python-checkins mailing list