@@ -11,6 +11,7 @@ def test(msg, results):
1111 fp .seek (0 )
1212 m = rfc822 .Message (fp )
1313 i = 0
14+
1415 for n , a in m .getaddrlist ('to' ) + m .getaddrlist ('cc' ):
1516 if verbose :
1617 print 'name:' , repr (n ), 'addr:' , repr (a )
@@ -28,6 +29,21 @@ def test(msg, results):
2829 print ' [no match]'
2930 print 'not found:' , repr (n ), repr (a )
3031
32+ out = m .getdate ('date' )
33+ if out :
34+ if verbose :
35+ print 'Date:' , m .getheader ('date' )
36+ if out == (1999 , 1 , 13 , 23 , 57 , 35 , 0 , 0 , 0 ):
37+ if verbose :
38+ print ' [matched]'
39+ else :
40+ if verbose :
41+ print ' [no match]'
42+ print 'Date conversion failed:' , out
43+
44+ # Note: all test cases must have the same date (in various formats),
45+ # or no date!
46+
3147test ('''Date: Wed, 13 Jan 1999 23:57:35 -0500
3248From: Guido van Rossum <[email protected] > 3349To: "Guido van
@@ -40,20 +56,23 @@ def test(msg, results):
4056test (
'''From: Barry <[email protected] 4157To: [email protected] (Guido: the Barbarian) 4258Subject: nonsense
59+ Date: Wednesday, January 13 1999 23:57:35 -0500
4360
4461test''' , [(
'Guido: the Barbarian' ,
'[email protected] ' ),
4562 ])
4663
4764test (
'''From: Barry <[email protected] 4865To: [email protected] (Guido: the Barbarian) 4966Cc: "Guido: the Madman" <[email protected] > 67+ Date: 13-Jan-1999 23:57:35 EST
5068
5169test''' , [(
'Guido: the Barbarian' ,
'[email protected] ' ),
5270 (
'Guido: the Madman' ,
'[email protected] ' )
5371 ])
5472
5573test ('''To: "The monster with
5674 the very long name: Guido" <[email protected] > 75+ Date: Wed, 13 Jan 1999 23:57:35 -0500
5776
5877test''' , [('The monster with\n the very long name: Guido' ,
5978@@ -63,6 +82,7 @@ def test(msg, results):
63826483658485+ Date: Wed, 13 Jan 1999 23:57:35 -0500
6686
6787test''' , [(
'Amit J. Patel' ,
'[email protected] ' ),
6888 (
'Mike Fletcher' ,
'[email protected] ' ),
@@ -75,6 +95,7 @@ def test(msg, results):
7595# This one is just twisted. I don't know what the proper result should be,
7696# but it shouldn't be to infloop, which is what used to happen!
779798+ Date: Wed, 13 Jan 1999 23:57:35 -0500
7899
79100test''' , [('' , '' ),
80101
0 commit comments