Benjamin Peterson | ee8712c | 2008-05-20 21:35:26 +0000 | [diff] [blame] | 1 | from test import support |
Barry Warsaw | b0c2232 | 1996-12-06 23:30:07 +0000 | [diff] [blame] | 2 | import time |
Fred Drake | bc56198 | 2001-05-22 17:02:02 +0000 | [diff] [blame] | 3 | import unittest |
Martin v. Löwis | 1b01ccd | 2009-05-30 06:13:40 +0000 | [diff] [blame] | 4 | import locale |
Barry Warsaw | b0c2232 | 1996-12-06 23:30:07 +0000 | [diff] [blame] | 5 | |
Fred Drake | bc56198 | 2001-05-22 17:02:02 +0000 | [diff] [blame] | 6 | class TimeTestCase(unittest.TestCase): |
Barry Warsaw | b0c2232 | 1996-12-06 23:30:07 +0000 | [diff] [blame] | 7 | |
Fred Drake | bc56198 | 2001-05-22 17:02:02 +0000 | [diff] [blame] | 8 | def setUp(self): |
| 9 | self.t = time.time() |
Barry Warsaw | b0c2232 | 1996-12-06 23:30:07 +0000 | [diff] [blame] | 10 | |
Fred Drake | bc56198 | 2001-05-22 17:02:02 +0000 | [diff] [blame] | 11 | def test_data_attributes(self): |
| 12 | time.altzone |
| 13 | time.daylight |
| 14 | time.timezone |
| 15 | time.tzname |
Barry Warsaw | b0c2232 | 1996-12-06 23:30:07 +0000 | [diff] [blame] | 16 | |
Fred Drake | bc56198 | 2001-05-22 17:02:02 +0000 | [diff] [blame] | 17 | def test_clock(self): |
| 18 | time.clock() |
Barry Warsaw | b0c2232 | 1996-12-06 23:30:07 +0000 | [diff] [blame] | 19 | |
Fred Drake | bc56198 | 2001-05-22 17:02:02 +0000 | [diff] [blame] | 20 | def test_conversions(self): |
Benjamin Peterson | c9c0f20 | 2009-06-30 23:06:06 +0000 | [diff] [blame] | 21 | self.assertTrue(time.ctime(self.t) |
Fred Drake | bc56198 | 2001-05-22 17:02:02 +0000 | [diff] [blame] | 22 | == time.asctime(time.localtime(self.t))) |
Benjamin Peterson | c9c0f20 | 2009-06-30 23:06:06 +0000 | [diff] [blame] | 23 | self.assertTrue(int(time.mktime(time.localtime(self.t))) |
Guido van Rossum | e2a383d | 2007-01-15 16:59:06 +0000 | [diff] [blame] | 24 | == int(self.t)) |
Fred Drake | bc56198 | 2001-05-22 17:02:02 +0000 | [diff] [blame] | 25 | |
| 26 | def test_sleep(self): |
| 27 | time.sleep(1.2) |
| 28 | |
| 29 | def test_strftime(self): |
| 30 | tt = time.gmtime(self.t) |
| 31 | for directive in ('a', 'A', 'b', 'B', 'c', 'd', 'H', 'I', |
| 32 | 'j', 'm', 'M', 'p', 'S', |
| 33 | 'U', 'w', 'W', 'x', 'X', 'y', 'Y', 'Z', '%'): |
| 34 | format = ' %' + directive |
| 35 | try: |
| 36 | time.strftime(format, tt) |
| 37 | except ValueError: |
| 38 | self.fail('conversion specifier: %r failed.' % format) |
| 39 | |
Alexander Belopolsky | 38e2996 | 2010-10-01 14:18:49 +0000 | [diff] [blame^] | 40 | def _bounds_checking(self, func=time.strftime): |
Brett Cannon | d1080a3 | 2004-03-02 04:38:10 +0000 | [diff] [blame] | 41 | # Make sure that strftime() checks the bounds of the various parts |
Thomas Wouters | 0e3f591 | 2006-08-11 14:57:12 +0000 | [diff] [blame] | 42 | #of the time tuple (0 is valid for *all* values). |
Brett Cannon | d1080a3 | 2004-03-02 04:38:10 +0000 | [diff] [blame] | 43 | |
Thomas Wouters | 0e3f591 | 2006-08-11 14:57:12 +0000 | [diff] [blame] | 44 | # Check year [1900, max(int)] |
Alexander Belopolsky | 38e2996 | 2010-10-01 14:18:49 +0000 | [diff] [blame^] | 45 | self.assertRaises(ValueError, func, |
Brett Cannon | d1080a3 | 2004-03-02 04:38:10 +0000 | [diff] [blame] | 46 | (1899, 1, 1, 0, 0, 0, 0, 1, -1)) |
| 47 | if time.accept2dyear: |
Alexander Belopolsky | 38e2996 | 2010-10-01 14:18:49 +0000 | [diff] [blame^] | 48 | self.assertRaises(ValueError, func, |
Brett Cannon | d1080a3 | 2004-03-02 04:38:10 +0000 | [diff] [blame] | 49 | (-1, 1, 1, 0, 0, 0, 0, 1, -1)) |
Alexander Belopolsky | 38e2996 | 2010-10-01 14:18:49 +0000 | [diff] [blame^] | 50 | self.assertRaises(ValueError, func, |
Brett Cannon | d1080a3 | 2004-03-02 04:38:10 +0000 | [diff] [blame] | 51 | (100, 1, 1, 0, 0, 0, 0, 1, -1)) |
Thomas Wouters | 0e3f591 | 2006-08-11 14:57:12 +0000 | [diff] [blame] | 52 | # Check month [1, 12] + zero support |
Alexander Belopolsky | 38e2996 | 2010-10-01 14:18:49 +0000 | [diff] [blame^] | 53 | self.assertRaises(ValueError, func, |
Thomas Wouters | 0e3f591 | 2006-08-11 14:57:12 +0000 | [diff] [blame] | 54 | (1900, -1, 1, 0, 0, 0, 0, 1, -1)) |
Alexander Belopolsky | 38e2996 | 2010-10-01 14:18:49 +0000 | [diff] [blame^] | 55 | self.assertRaises(ValueError, func, |
Brett Cannon | d1080a3 | 2004-03-02 04:38:10 +0000 | [diff] [blame] | 56 | (1900, 13, 1, 0, 0, 0, 0, 1, -1)) |
Thomas Wouters | 0e3f591 | 2006-08-11 14:57:12 +0000 | [diff] [blame] | 57 | # Check day of month [1, 31] + zero support |
Alexander Belopolsky | 38e2996 | 2010-10-01 14:18:49 +0000 | [diff] [blame^] | 58 | self.assertRaises(ValueError, func, |
Thomas Wouters | 0e3f591 | 2006-08-11 14:57:12 +0000 | [diff] [blame] | 59 | (1900, 1, -1, 0, 0, 0, 0, 1, -1)) |
Alexander Belopolsky | 38e2996 | 2010-10-01 14:18:49 +0000 | [diff] [blame^] | 60 | self.assertRaises(ValueError, func, |
Brett Cannon | d1080a3 | 2004-03-02 04:38:10 +0000 | [diff] [blame] | 61 | (1900, 1, 32, 0, 0, 0, 0, 1, -1)) |
Thomas Wouters | 0e3f591 | 2006-08-11 14:57:12 +0000 | [diff] [blame] | 62 | # Check hour [0, 23] |
Alexander Belopolsky | 38e2996 | 2010-10-01 14:18:49 +0000 | [diff] [blame^] | 63 | self.assertRaises(ValueError, func, |
Brett Cannon | d1080a3 | 2004-03-02 04:38:10 +0000 | [diff] [blame] | 64 | (1900, 1, 1, -1, 0, 0, 0, 1, -1)) |
Alexander Belopolsky | 38e2996 | 2010-10-01 14:18:49 +0000 | [diff] [blame^] | 65 | self.assertRaises(ValueError, func, |
Brett Cannon | d1080a3 | 2004-03-02 04:38:10 +0000 | [diff] [blame] | 66 | (1900, 1, 1, 24, 0, 0, 0, 1, -1)) |
Thomas Wouters | 0e3f591 | 2006-08-11 14:57:12 +0000 | [diff] [blame] | 67 | # Check minute [0, 59] |
Alexander Belopolsky | 38e2996 | 2010-10-01 14:18:49 +0000 | [diff] [blame^] | 68 | self.assertRaises(ValueError, func, |
Brett Cannon | d1080a3 | 2004-03-02 04:38:10 +0000 | [diff] [blame] | 69 | (1900, 1, 1, 0, -1, 0, 0, 1, -1)) |
Alexander Belopolsky | 38e2996 | 2010-10-01 14:18:49 +0000 | [diff] [blame^] | 70 | self.assertRaises(ValueError, func, |
Brett Cannon | d1080a3 | 2004-03-02 04:38:10 +0000 | [diff] [blame] | 71 | (1900, 1, 1, 0, 60, 0, 0, 1, -1)) |
Thomas Wouters | 0e3f591 | 2006-08-11 14:57:12 +0000 | [diff] [blame] | 72 | # Check second [0, 61] |
Alexander Belopolsky | 38e2996 | 2010-10-01 14:18:49 +0000 | [diff] [blame^] | 73 | self.assertRaises(ValueError, func, |
Brett Cannon | d1080a3 | 2004-03-02 04:38:10 +0000 | [diff] [blame] | 74 | (1900, 1, 1, 0, 0, -1, 0, 1, -1)) |
| 75 | # C99 only requires allowing for one leap second, but Python's docs say |
| 76 | # allow two leap seconds (0..61) |
Alexander Belopolsky | 38e2996 | 2010-10-01 14:18:49 +0000 | [diff] [blame^] | 77 | self.assertRaises(ValueError, func, |
Brett Cannon | d1080a3 | 2004-03-02 04:38:10 +0000 | [diff] [blame] | 78 | (1900, 1, 1, 0, 0, 62, 0, 1, -1)) |
| 79 | # No check for upper-bound day of week; |
| 80 | # value forced into range by a ``% 7`` calculation. |
| 81 | # Start check at -2 since gettmarg() increments value before taking |
| 82 | # modulo. |
Alexander Belopolsky | 38e2996 | 2010-10-01 14:18:49 +0000 | [diff] [blame^] | 83 | self.assertRaises(ValueError, func, |
Brett Cannon | d1080a3 | 2004-03-02 04:38:10 +0000 | [diff] [blame] | 84 | (1900, 1, 1, 0, 0, 0, -2, 1, -1)) |
Thomas Wouters | 0e3f591 | 2006-08-11 14:57:12 +0000 | [diff] [blame] | 85 | # Check day of the year [1, 366] + zero support |
Alexander Belopolsky | 38e2996 | 2010-10-01 14:18:49 +0000 | [diff] [blame^] | 86 | self.assertRaises(ValueError, func, |
Thomas Wouters | 0e3f591 | 2006-08-11 14:57:12 +0000 | [diff] [blame] | 87 | (1900, 1, 1, 0, 0, 0, 0, -1, -1)) |
Alexander Belopolsky | 38e2996 | 2010-10-01 14:18:49 +0000 | [diff] [blame^] | 88 | self.assertRaises(ValueError, func, |
Brett Cannon | d1080a3 | 2004-03-02 04:38:10 +0000 | [diff] [blame] | 89 | (1900, 1, 1, 0, 0, 0, 0, 367, -1)) |
Brett Cannon | d1080a3 | 2004-03-02 04:38:10 +0000 | [diff] [blame] | 90 | |
Alexander Belopolsky | 38e2996 | 2010-10-01 14:18:49 +0000 | [diff] [blame^] | 91 | def test_strftime_bounding_check(self): |
| 92 | self._bounds_checking(lambda tup: time.strftime('', tup)) |
| 93 | |
Thomas Wouters | 0e3f591 | 2006-08-11 14:57:12 +0000 | [diff] [blame] | 94 | def test_default_values_for_zero(self): |
| 95 | # Make sure that using all zeros uses the proper default values. |
| 96 | # No test for daylight savings since strftime() does not change output |
| 97 | # based on its value. |
| 98 | expected = "2000 01 01 00 00 00 1 001" |
| 99 | result = time.strftime("%Y %m %d %H %M %S %w %j", (0,)*9) |
| 100 | self.assertEquals(expected, result) |
| 101 | |
Guido van Rossum | 00efe7e | 2002-07-19 17:04:46 +0000 | [diff] [blame] | 102 | def test_strptime(self): |
Thomas Wouters | 89f507f | 2006-12-13 04:49:30 +0000 | [diff] [blame] | 103 | # Should be able to go round-trip from strftime to strptime without |
| 104 | # throwing an exception. |
Guido van Rossum | 00efe7e | 2002-07-19 17:04:46 +0000 | [diff] [blame] | 105 | tt = time.gmtime(self.t) |
| 106 | for directive in ('a', 'A', 'b', 'B', 'c', 'd', 'H', 'I', |
| 107 | 'j', 'm', 'M', 'p', 'S', |
| 108 | 'U', 'w', 'W', 'x', 'X', 'y', 'Y', 'Z', '%'): |
Thomas Wouters | 89f507f | 2006-12-13 04:49:30 +0000 | [diff] [blame] | 109 | format = '%' + directive |
| 110 | strf_output = time.strftime(format, tt) |
Guido van Rossum | 00efe7e | 2002-07-19 17:04:46 +0000 | [diff] [blame] | 111 | try: |
Thomas Wouters | 89f507f | 2006-12-13 04:49:30 +0000 | [diff] [blame] | 112 | time.strptime(strf_output, format) |
Guido van Rossum | 00efe7e | 2002-07-19 17:04:46 +0000 | [diff] [blame] | 113 | except ValueError: |
Thomas Wouters | 89f507f | 2006-12-13 04:49:30 +0000 | [diff] [blame] | 114 | self.fail("conversion specifier %r failed with '%s' input." % |
| 115 | (format, strf_output)) |
Guido van Rossum | 00efe7e | 2002-07-19 17:04:46 +0000 | [diff] [blame] | 116 | |
Brett Cannon | 7f6b4f8 | 2009-03-30 21:30:26 +0000 | [diff] [blame] | 117 | def test_strptime_bytes(self): |
| 118 | # Make sure only strings are accepted as arguments to strptime. |
| 119 | self.assertRaises(TypeError, time.strptime, b'2009', "%Y") |
| 120 | self.assertRaises(TypeError, time.strptime, '2009', b'%Y') |
| 121 | |
Fred Drake | bc56198 | 2001-05-22 17:02:02 +0000 | [diff] [blame] | 122 | def test_asctime(self): |
| 123 | time.asctime(time.gmtime(self.t)) |
| 124 | self.assertRaises(TypeError, time.asctime, 0) |
| 125 | |
Alexander Belopolsky | 38e2996 | 2010-10-01 14:18:49 +0000 | [diff] [blame^] | 126 | def test_asctime_bounding_check(self): |
| 127 | self._bounds_checking(time.asctime) |
| 128 | |
Guido van Rossum | d11b62e | 2003-03-14 21:51:36 +0000 | [diff] [blame] | 129 | def test_tzset(self): |
Guido van Rossum | d2b738e | 2003-03-15 12:01:52 +0000 | [diff] [blame] | 130 | if not hasattr(time, "tzset"): |
| 131 | return # Can't test this; don't want the test suite to fail |
| 132 | |
Guido van Rossum | d11b62e | 2003-03-14 21:51:36 +0000 | [diff] [blame] | 133 | from os import environ |
| 134 | |
Tim Peters | 0eadaac | 2003-04-24 16:02:54 +0000 | [diff] [blame] | 135 | # Epoch time of midnight Dec 25th 2002. Never DST in northern |
Guido van Rossum | d11b62e | 2003-03-14 21:51:36 +0000 | [diff] [blame] | 136 | # hemisphere. |
Tim Peters | 0eadaac | 2003-04-24 16:02:54 +0000 | [diff] [blame] | 137 | xmas2002 = 1040774400.0 |
Guido van Rossum | d11b62e | 2003-03-14 21:51:36 +0000 | [diff] [blame] | 138 | |
Neal Norwitz | 7f2588c | 2003-04-11 15:35:53 +0000 | [diff] [blame] | 139 | # These formats are correct for 2002, and possibly future years |
| 140 | # This format is the 'standard' as documented at: |
| 141 | # http://www.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap08.html |
| 142 | # They are also documented in the tzset(3) man page on most Unix |
| 143 | # systems. |
Tim Peters | 0eadaac | 2003-04-24 16:02:54 +0000 | [diff] [blame] | 144 | eastern = 'EST+05EDT,M4.1.0,M10.5.0' |
Neal Norwitz | 7f2588c | 2003-04-11 15:35:53 +0000 | [diff] [blame] | 145 | victoria = 'AEST-10AEDT-11,M10.5.0,M3.5.0' |
| 146 | utc='UTC+0' |
| 147 | |
Guido van Rossum | d11b62e | 2003-03-14 21:51:36 +0000 | [diff] [blame] | 148 | org_TZ = environ.get('TZ',None) |
| 149 | try: |
Guido van Rossum | d11b62e | 2003-03-14 21:51:36 +0000 | [diff] [blame] | 150 | # Make sure we can switch to UTC time and results are correct |
| 151 | # Note that unknown timezones default to UTC. |
Neal Norwitz | 7f2588c | 2003-04-11 15:35:53 +0000 | [diff] [blame] | 152 | # Note that altzone is undefined in UTC, as there is no DST |
| 153 | environ['TZ'] = eastern |
| 154 | time.tzset() |
| 155 | environ['TZ'] = utc |
| 156 | time.tzset() |
Benjamin Peterson | c9c0f20 | 2009-06-30 23:06:06 +0000 | [diff] [blame] | 157 | self.assertEqual( |
Neal Norwitz | 7f2588c | 2003-04-11 15:35:53 +0000 | [diff] [blame] | 158 | time.gmtime(xmas2002), time.localtime(xmas2002) |
| 159 | ) |
Benjamin Peterson | c9c0f20 | 2009-06-30 23:06:06 +0000 | [diff] [blame] | 160 | self.assertEqual(time.daylight, 0) |
| 161 | self.assertEqual(time.timezone, 0) |
| 162 | self.assertEqual(time.localtime(xmas2002).tm_isdst, 0) |
Guido van Rossum | d11b62e | 2003-03-14 21:51:36 +0000 | [diff] [blame] | 163 | |
| 164 | # Make sure we can switch to US/Eastern |
Neal Norwitz | 7f2588c | 2003-04-11 15:35:53 +0000 | [diff] [blame] | 165 | environ['TZ'] = eastern |
Guido van Rossum | d11b62e | 2003-03-14 21:51:36 +0000 | [diff] [blame] | 166 | time.tzset() |
Benjamin Peterson | c9c0f20 | 2009-06-30 23:06:06 +0000 | [diff] [blame] | 167 | self.assertNotEqual(time.gmtime(xmas2002), time.localtime(xmas2002)) |
| 168 | self.assertEqual(time.tzname, ('EST', 'EDT')) |
| 169 | self.assertEqual(len(time.tzname), 2) |
| 170 | self.assertEqual(time.daylight, 1) |
| 171 | self.assertEqual(time.timezone, 18000) |
| 172 | self.assertEqual(time.altzone, 14400) |
| 173 | self.assertEqual(time.localtime(xmas2002).tm_isdst, 0) |
| 174 | self.assertEqual(len(time.tzname), 2) |
Guido van Rossum | d11b62e | 2003-03-14 21:51:36 +0000 | [diff] [blame] | 175 | |
Neal Norwitz | 7f2588c | 2003-04-11 15:35:53 +0000 | [diff] [blame] | 176 | # Now go to the southern hemisphere. |
| 177 | environ['TZ'] = victoria |
Guido van Rossum | d11b62e | 2003-03-14 21:51:36 +0000 | [diff] [blame] | 178 | time.tzset() |
Benjamin Peterson | c9c0f20 | 2009-06-30 23:06:06 +0000 | [diff] [blame] | 179 | self.assertNotEqual(time.gmtime(xmas2002), time.localtime(xmas2002)) |
| 180 | self.assertTrue(time.tzname[0] == 'AEST', str(time.tzname[0])) |
| 181 | self.assertTrue(time.tzname[1] == 'AEDT', str(time.tzname[1])) |
| 182 | self.assertEqual(len(time.tzname), 2) |
| 183 | self.assertEqual(time.daylight, 1) |
| 184 | self.assertEqual(time.timezone, -36000) |
| 185 | self.assertEqual(time.altzone, -39600) |
| 186 | self.assertEqual(time.localtime(xmas2002).tm_isdst, 1) |
Guido van Rossum | d11b62e | 2003-03-14 21:51:36 +0000 | [diff] [blame] | 187 | |
Guido van Rossum | d11b62e | 2003-03-14 21:51:36 +0000 | [diff] [blame] | 188 | finally: |
| 189 | # Repair TZ environment variable in case any other tests |
| 190 | # rely on it. |
| 191 | if org_TZ is not None: |
| 192 | environ['TZ'] = org_TZ |
Guido van Rossum | e2b70bc | 2006-08-18 22:13:04 +0000 | [diff] [blame] | 193 | elif 'TZ' in environ: |
Guido van Rossum | d11b62e | 2003-03-14 21:51:36 +0000 | [diff] [blame] | 194 | del environ['TZ'] |
Neal Norwitz | 7f2588c | 2003-04-11 15:35:53 +0000 | [diff] [blame] | 195 | time.tzset() |
Tim Peters | 0eadaac | 2003-04-24 16:02:54 +0000 | [diff] [blame] | 196 | |
Tim Peters | 1b6f7a9 | 2004-06-20 02:50:16 +0000 | [diff] [blame] | 197 | def test_insane_timestamps(self): |
| 198 | # It's possible that some platform maps time_t to double, |
| 199 | # and that this test will fail there. This test should |
| 200 | # exempt such platforms (provided they return reasonable |
| 201 | # results!). |
| 202 | for func in time.ctime, time.gmtime, time.localtime: |
| 203 | for unreasonable in -1e200, 1e200: |
| 204 | self.assertRaises(ValueError, func, unreasonable) |
Fred Drake | bc56198 | 2001-05-22 17:02:02 +0000 | [diff] [blame] | 205 | |
Fred Drake | f901abd | 2004-08-03 17:58:55 +0000 | [diff] [blame] | 206 | def test_ctime_without_arg(self): |
| 207 | # Not sure how to check the values, since the clock could tick |
| 208 | # at any time. Make sure these are at least accepted and |
| 209 | # don't raise errors. |
| 210 | time.ctime() |
| 211 | time.ctime(None) |
| 212 | |
| 213 | def test_gmtime_without_arg(self): |
Thomas Wouters | 0e3f591 | 2006-08-11 14:57:12 +0000 | [diff] [blame] | 214 | gt0 = time.gmtime() |
| 215 | gt1 = time.gmtime(None) |
| 216 | t0 = time.mktime(gt0) |
| 217 | t1 = time.mktime(gt1) |
Benjamin Peterson | c9c0f20 | 2009-06-30 23:06:06 +0000 | [diff] [blame] | 218 | self.assertTrue(0 <= (t1-t0) < 0.2) |
Fred Drake | f901abd | 2004-08-03 17:58:55 +0000 | [diff] [blame] | 219 | |
| 220 | def test_localtime_without_arg(self): |
Thomas Wouters | 0e3f591 | 2006-08-11 14:57:12 +0000 | [diff] [blame] | 221 | lt0 = time.localtime() |
| 222 | lt1 = time.localtime(None) |
| 223 | t0 = time.mktime(lt0) |
| 224 | t1 = time.mktime(lt1) |
Benjamin Peterson | c9c0f20 | 2009-06-30 23:06:06 +0000 | [diff] [blame] | 225 | self.assertTrue(0 <= (t1-t0) < 0.2) |
Fred Drake | f901abd | 2004-08-03 17:58:55 +0000 | [diff] [blame] | 226 | |
Martin v. Löwis | 1b01ccd | 2009-05-30 06:13:40 +0000 | [diff] [blame] | 227 | class TestLocale(unittest.TestCase): |
| 228 | def setUp(self): |
| 229 | self.oldloc = locale.setlocale(locale.LC_ALL) |
Fred Drake | 2e2be37 | 2001-09-20 21:33:42 +0000 | [diff] [blame] | 230 | |
Martin v. Löwis | 1b01ccd | 2009-05-30 06:13:40 +0000 | [diff] [blame] | 231 | def tearDown(self): |
| 232 | locale.setlocale(locale.LC_ALL, self.oldloc) |
| 233 | |
Martin v. Löwis | a6a9c4d | 2009-05-30 06:15:30 +0000 | [diff] [blame] | 234 | def test_bug_3061(self): |
Martin v. Löwis | 1b01ccd | 2009-05-30 06:13:40 +0000 | [diff] [blame] | 235 | try: |
| 236 | tmp = locale.setlocale(locale.LC_ALL, "fr_FR") |
| 237 | except locale.Error: |
| 238 | # skip this test |
| 239 | return |
| 240 | # This should not cause an exception |
| 241 | time.strftime("%B", (2009,2,1,0,0,0,0,0,0)) |
| 242 | |
| 243 | def test_main(): |
| 244 | support.run_unittest(TimeTestCase, TestLocale) |
Fred Drake | 2e2be37 | 2001-09-20 21:33:42 +0000 | [diff] [blame] | 245 | |
| 246 | if __name__ == "__main__": |
| 247 | test_main() |