[Python-bugs-list] [ python-Bugs-482932 ] test_email makes assumptions about epoch

noreply@sourceforge.net noreply@sourceforge.net
Sun, 18 Nov 2001 15:08:44 -0800


Bugs item #482932, was opened at 2001-11-17 15:41
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=482932&group_id=5470

Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 8
Submitted By: Jack Jansen (jackjansen)
Assigned to: Barry Warsaw (bwarsaw)
Summary: test_email makes assumptions about epoch

Initial Comment:
test_email makes assumptions about the time.time() epoch being the Unix-standard of
Jan 1, 1970; in method test_formatdate().

This test fails on the Mac, where the epoch is Jan 1, 1904.

As I'm unsure of what the test actually tests I don't know whether the test is wrong
or whether Utils.formatdate() is wrong.

If this can be fixed quickly please let me know and I'll incorporate the fix in MacPython 2.2b2,
otherwise I'll add a note to the readme.


----------------------------------------------------------------------

>Comment By: Jack Jansen (jackjansen)
Date: 2001-11-18 15:08

Message:
Logged In: YES 
user_id=45365

Sorry, it returns Sat, 09 Nov 1935 16:33:52 -0000.

But: I hope your fix isn't going to if "if os.name == 'mac': compare to another value"?
I could have come up with that one:-)

I would assume that you're trying to test that a given date/time is rendered as such, in which
case I would suggest using a time tuple, which contains exact numbers for year and everything,
and contains the original timezone/dst flag as well. But: (why I didn't fix it myself) I'm not sure
that this is actually what you're testing...


----------------------------------------------------------------------

Comment By: Barry Warsaw (bwarsaw)
Date: 2001-11-18 15:01

Message:
Logged In: YES 
user_id=12800

My bad Jack.  I meant, what does
Utils.formatdate(1005327232.109884) return?

(see test_formatdate)

----------------------------------------------------------------------

Comment By: Jack Jansen (jackjansen)
Date: 2001-11-18 14:44

Message:
Logged In: YES 
user_id=45365

Here is the output with the relevant numbers:
Python 2.2b2 (#114, Nov 18 2001, 23:23:26)  [CW PPC GUSI2 GC] on mac
Type "copyright", "credits" or "license" for more information.
>>> import time
>>> now = time.time()
>>> time.ctime(now)
'Sun Nov 18 23:23:56 2001'
>>> time.ctime(0)
'Fri Jan  1 00:00:00 1904'
>>> import email
>>> email.Utils.formatdate(now)
'Sun, 18 Nov 2001 22:23:56 -0000'


----------------------------------------------------------------------

Comment By: Barry Warsaw (bwarsaw)
Date: 2001-11-18 08:46

Message:
Logged In: YES 
user_id=12800

Tell me what strings time.ctime(0) and Utils.formatdate(now)
returns and I'll adjust the test case.


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=482932&group_id=5470