(self)
| 71 | self.assertEqual(parse_date("03-Feb-98"), (1998, 2, 3, 0, 0, 0.0)) |
| 72 | |
| 73 | def test_http2time_formats(self): |
| 74 | # test http2time for supported dates. Test cases with 2 digit year |
| 75 | # will probably break in year 2044. |
| 76 | tests = [ |
| 77 | 'Thu, 03 Feb 1994 00:00:00 GMT', # proposed new HTTP format |
| 78 | 'Thursday, 03-Feb-94 00:00:00 GMT', # old rfc850 HTTP format |
| 79 | 'Thursday, 03-Feb-1994 00:00:00 GMT', # broken rfc850 HTTP format |
| 80 | |
| 81 | '03 Feb 1994 00:00:00 GMT', # HTTP format (no weekday) |
| 82 | '03-Feb-94 00:00:00 GMT', # old rfc850 (no weekday) |
| 83 | '03-Feb-1994 00:00:00 GMT', # broken rfc850 (no weekday) |
| 84 | '03-Feb-1994 00:00 GMT', # broken rfc850 (no weekday, no seconds) |
| 85 | '03-Feb-1994 00:00', # broken rfc850 (no weekday, no seconds, no tz) |
| 86 | '02-Feb-1994 24:00', # broken rfc850 (no weekday, no seconds, |
| 87 | # no tz) using hour 24 with yesterday date |
| 88 | |
| 89 | '03-Feb-94', # old rfc850 HTTP format (no weekday, no time) |
| 90 | '03-Feb-1994', # broken rfc850 HTTP format (no weekday, no time) |
| 91 | '03 Feb 1994', # proposed new HTTP format (no weekday, no time) |
| 92 | |
| 93 | # A few tests with extra space at various places |
| 94 | ' 03 Feb 1994 0:00 ', |
| 95 | ' 03-Feb-1994 ', |
| 96 | ] |
| 97 | |
| 98 | test_t = 760233600 # assume broken POSIX counting of seconds |
| 99 | result = time2isoz(test_t) |
| 100 | expected = "1994-02-03 00:00:00Z" |
| 101 | self.assertEqual(result, expected, |
| 102 | "%s => '%s' (%s)" % (test_t, result, expected)) |
| 103 | |
| 104 | for s in tests: |
| 105 | self.assertEqual(http2time(s), test_t, s) |
| 106 | self.assertEqual(http2time(s.lower()), test_t, s.lower()) |
| 107 | self.assertEqual(http2time(s.upper()), test_t, s.upper()) |
| 108 | |
| 109 | @support.subTests('test', [ |
| 110 | '', |
nothing calls this directly
no test coverage detected