From 8adc0b54d4f995ff739967fdc70d6a6e53ac1f90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Valur=20J=C3=B3nsson?= Date: Thu, 15 Jan 2009 09:09:13 +0000 Subject: 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. --- Lib/test/test_datetime.py | 15 ++++++++++++--- Lib/test/test_os.py | 4 ++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Lib/test/test_datetime.py b/Lib/test/test_datetime.py index 89fa5c8..24ec895 100644 --- a/Lib/test/test_datetime.py +++ b/Lib/test/test_datetime.py @@ -857,9 +857,18 @@ class TestDate(HarmlessMixedComparison, unittest.TestCase): 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") diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index c89a23f..4702e7c 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -559,11 +559,11 @@ class TestInvalidFD(unittest.TestCase): 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"): -- cgit v0.12