summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2001-11-18 23:15:58 (GMT)
committerBarry Warsaw <barry@python.org>2001-11-18 23:15:58 (GMT)
commit7a1bea64f8a677809a7e6fc8d1f7d0a099a0f246 (patch)
tree5c270e7869370b5d39c2a1d5ec47de108478d64c /Lib/test
parent69ab5836ae8e1363df93102a47fd7d2e0e17409e (diff)
downloadcpython-7a1bea64f8a677809a7e6fc8d1f7d0a099a0f246.zip
cpython-7a1bea64f8a677809a7e6fc8d1f7d0a099a0f246.tar.gz
cpython-7a1bea64f8a677809a7e6fc8d1f7d0a099a0f246.tar.bz2
test_formatdate(): A test that has a mild hope of working on Mac,
which has a different epoch than *nix. Jack may need to twiddle the details.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_email.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/Lib/test/test_email.py b/Lib/test/test_email.py
index 37ddc30..4de0514 100644
--- a/Lib/test/test_email.py
+++ b/Lib/test/test_email.py
@@ -921,9 +921,19 @@ class TestMiscellaneous(unittest.TestCase):
def test_formatdate(self):
now = 1005327232.109884
+ time0 = time.ctime(0)
+ # When does the epoch start?
+ if time0 == 'Wed Dec 31 19:00:00 1969':
+ # traditional Unix epoch
+ matchdate = 'Fri, 09 Nov 2001 17:33:52 -0000'
+ elif time0 == 'Fri Jan 1 00:00:00 1904':
+ # Mac epoch
+ matchdate = 'Sat, 09 Nov 1935 16:33:52 -0000'
+ else:
+ matchdate = "I don't understand your epoch"
gdate = Utils.formatdate(now)
ldate = Utils.formatdate(now, localtime=1)
- self.assertEqual(gdate, 'Fri, 09 Nov 2001 17:33:52 -0000')
+ self.assertEqual(gdate, matchdate)
# It's a little tougher to test for localtime, but we'll try. Skip if
# we don't have strptime().
if hasattr(time, 'strptime'):