diff options
Diffstat (limited to 'Lib/test/test_strftime.py')
-rw-r--r-- | Lib/test/test_strftime.py | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/Lib/test/test_strftime.py b/Lib/test/test_strftime.py index 78c9c5bdb9..772cd0688c 100644 --- a/Lib/test/test_strftime.py +++ b/Lib/test/test_strftime.py @@ -182,26 +182,23 @@ class Y1900Tests(unittest.TestCase): a date before 1900 is passed with a format string containing "%y" """ - @unittest.skipUnless(sys.platform == "win32", "Only applies to Windows") - def test_y_before_1900_win(self): - with self.assertRaises(ValueError): - time.strftime("%y", (1899, 1, 1, 0, 0, 0, 0, 0, 0)) - - @unittest.skipIf(sys.platform == "win32", "Doesn't apply on Windows") - def test_y_before_1900_nonwin(self): - self.assertEquals( - time.strftime("%y", (1899, 1, 1, 0, 0, 0, 0, 0, 0)), "99") + def test_y_before_1900(self): + # Issue #13674, #19634 + t = (1899, 1, 1, 0, 0, 0, 0, 0, 0) + if (sys.platform == "win32" + or sys.platform.startswith(("aix", "sunos", "solaris"))): + with self.assertRaises(ValueError): + time.strftime("%y", t) + else: + self.assertEqual(time.strftime("%y", t), "99") def test_y_1900(self): - self.assertEquals( + self.assertEqual( time.strftime("%y", (1900, 1, 1, 0, 0, 0, 0, 0, 0)), "00") def test_y_after_1900(self): - self.assertEquals( + self.assertEqual( time.strftime("%y", (2013, 1, 1, 0, 0, 0, 0, 0, 0)), "13") -def test_main(): - support.run_unittest(StrftimeTest, Y1900Tests) - if __name__ == '__main__': - test_main() + unittest.main() |