summaryrefslogtreecommitdiffstats
path: root/Lib/email/test
Commit message (Collapse)AuthorAgeFilesLines
* Forward port some fixes that were in email 2.5 but for some reason didn't makeBarry Warsaw2006-07-262-0/+88
| | | | | | | it into email 4.0. Specifically, in Message.get_content_charset(), handle RFC 2231 headers that contain an encoding not known to Python, or a character in the data that isn't in the charset encoding. Also forward port the appropriate unit tests.
* More RFC 2231 improvements for the email 4.0 package. As Mark Sapiro rightlyBarry Warsaw2006-07-212-22/+242
| | | | | | | | | | | | | | | | | | | | | | | | points out there are really two types of continued headers defined in this RFC (i.e. "encoded" parameters with the form "name*0*=" and unencoded parameters with the form "name*0="), but we were were handling them both the same way and that isn't correct. This patch should be much more RFC compliant in that only encoded params are %-decoded and the charset/language information is only extract if there are any encoded params in the segments. If there are no encoded params then the RFC says that there will be no charset/language parts. Note however that this will change the return value for Message.get_param() in some cases. For example, whereas before if you had all unencoded param continuations you would have still gotten a 3-tuple back from this method (with charset and language == None), you will now get just a string. I don't believe this is a backward incompatible change though because the documentation for this method already indicates that either return value is possible and that you must do an isinstance(val, tuple) check to discriminate between the two. (Yeah that API kind of sucks but we can't change /that/ without breaking code.) Test cases, some documentation updates, and a NEWS item accompany this patch.
* decode_rfc2231(): Be more robust against buggy RFC 2231 encodings.Barry Warsaw2006-07-171-0/+34
| | | | | | | | | | | | | | | | | Specifically, instead of raising a ValueError when there is a single tick in the parameter, simply return that the entire string unquoted, with None for both the charset and the language. Also, if there are more than 2 ticks in the parameter, interpret the first three parts as the standard RFC 2231 parts, then the rest of the parts as the encoded string. Test cases added. Original fewer-than-3-parts fix by Tokio Kikuchi. Resolves SF bug # 1218081. I will back port the fix and tests to Python 2.4 (email 3.0) and Python 2.3 (email 2.5). Also, bump the version number to email 4.0.1, removing the 'alpha' moniker.
* Port forward from 2.4 branch:Barry Warsaw2006-05-012-0/+12
| | | | | | | | | | Patch #1464708 from William McVey: fixed handling of nested comments in mail addresses. E.g. "Foo ((Foo Bar)) <foo@example.com>" Fixes for both rfc822.py and email package. This patch needs to be back ported to Python 2.3 for email 2.5.
* The email module's parsedate_tz function now sets the daylight savingsAnthony Baxter2006-04-032-4/+4
| | | | | | flag to -1 (unknown) since it can't tell from the date whether it should be set. patch from Aldo Cortesi
* Merge email package 4.0 from the sandbox, including documentation, test cases,Barry Warsaw2006-03-184-52/+3235
| | | | and NEWS updates.
* Actually this file should have svn:eol-style CRLF since it's specificallyBarry Warsaw2006-03-041-45/+45
| | | | testing line ending compatibility.
* Set eol-style to native -- doesn't appear to be any reasonTim Peters2006-03-041-45/+45
| | | | for it to claim it has mime-type application/octet-stream.
* Port relevant patches for SF 1409455 to the trunk for email 3.0/Python 2.5.Barry Warsaw2006-02-082-2/+14
| | | | Will port to Python 2.4.
* Resolves SF bug #1423972.Barry Warsaw2006-02-041-2/+4
|
* parsedate_tz(): Minor cleanup.Barry Warsaw2006-02-031-0/+9
| | | | | Port from Python 2.3/email 2.5: Add a test for the tm_yday field is 1 in the return of parsedate().
* SF bug #1347874; FeedParser does not comply with RFC2822.Barry Warsaw2006-01-171-0/+9
| | | | | Change headerRE as suggested in the bug report, so that single character headers are accepted. Test case added too. Will backport to Python 2.4.
* Ported 42075 from release23-maint branch.Barry Warsaw2006-01-172-1/+43
| | | | | | | | | | | SF bug #1403349 solution for email 3.0; some MUAs use the 'file' parameter name in the Content-Distribution header, so Message.get_filename() should fall back to using that. Will port to the Python 2.5 trunk. Also, bump the email package version to 3.0.1 for eventual release. Of course, add a test case too. XXX Need to update the documentation.
* fix broken (unexecuted) testAnthony Baxter2005-06-081-3/+3
|
* Fixes for SF #1076485, which I'll apply to the CVS head too. The problem wasBarry Warsaw2004-12-052-1/+260
| | | | | | | | | | | | | | | | caused by a self._input.readline() call that wasn't checking for the NeedsMoreData marker. msg_43.txt contains a message that illustrates the problem, when email.message_from_*() is called. That interface uses the Parser API, which splits reads into 8192 byte chunks. It so happens that for the test message, the 8192 chunk falls inside a message/delivery-status, which is where in the FeedParser the readline() call was that didn't check for NeedsMoreData. I also added an assert to unreadline() so it'll be more evident if an attempt to push back NeedsMoreData ever happens again. Bump the email package version number.
* RFC 2822 describes the characters allowed in a header field name. Conform toBarry Warsaw2004-11-291-0/+16
| | | | this, and add test cases.
* Fix for SF bug #1072623. When the last line of the input string does not endBarry Warsaw2004-11-281-0/+14
| | | | | | | | | in a newline, and it's an end boundary, the FeedParser wasn't recognizing it as such. Tweak the regexp to make the ending linesep optional. For grins, clear self._partial when closing the BufferedSubFile. Added a test case.
* test_boundary_with_leading_space(): Test case for SF bug #1060941. RFC 2046Barry Warsaw2004-11-061-0/+19
| | | | | | says boundaries may begin -- but not end -- with whitespace. I will backport to Python 2.3.
* Added a usegmt flag to email.Utils.formatdate - this allows it to beAnthony Baxter2004-10-111-0/+9
| | | | | used to replace rfc822.formatdate for protocols like HTTP (where 'GMT' must be the timezone string).
* An example message for SF bug # 1030941.Barry Warsaw2004-10-091-0/+20
|
* test_missing_start_boundary(): A test for SF bug # 1030941.Barry Warsaw2004-10-091-0/+15
|
* Fix test for FeedParser results.Barry Warsaw2004-10-031-2/+2
|
* Big email 3.0 API changes, with updated unit tests and documentation.Barry Warsaw2004-10-033-117/+51
| | | | | | | | | | | | | | | | | Briefly (from the NEWS file): - Updates for the email package: + All deprecated APIs that in email 2.x issued warnings have been removed: _encoder argument to the MIMEText constructor, Message.add_payload(), Utils.dump_address_pair(), Utils.decode(), Utils.encode() + New deprecations: Generator.__call__(), Message.get_type(), Message.get_main_type(), Message.get_subtype(), the 'strict' argument to the Parser constructor. These will be removed in email 3.1. + Support for Python earlier than 2.3 has been removed (see PEP 291). + All defect classes have been renamed to end in 'Defect'. + Some FeedParser fixes; also a MultipartInvariantViolationDefect will be added to messages that claim to be multipart but really aren't. + Updates to documentation.
* Test cases and fixes for bugs described in patch #873418: email/Message.py:Barry Warsaw2004-08-161-0/+12
| | | | del_param fails when specifying a header.
* Resolution of bug #997368, "strftime() backward compatibility".Barry Warsaw2004-08-071-2/+2
| | | | | | | | | Specifically, time.strftime() no longer accepts a 0 in the yday position of a time tuple, since that can crash some platform strftime() implementations. parsedate_tz(): Change the return value to return 1 in the yday position. Update tests in test_rfc822.py and test_email.py
* Resolution of SF bug #1002475 and patch #1003693; Header lines that end inBarry Warsaw2004-08-071-1/+30
| | | | | | | | | | \r\n only get the \n stripped, not the \r (unless it's the last header which does get the \r stripped). Patch by Tony Meyer. test_whitespace_continuation_last_header(), test_strip_line_feed_and_carriage_return_in_headers(): New tests. _parse_headers(): Be sure to strip \r\n from the right side of header lines.
* forward porting from release23-maintBarry Warsaw2004-05-131-0/+10
|
* test_boundary_in_non_multipart(): Added a test for SF bug # 846938.Barry Warsaw2004-05-131-0/+15
|
* test_nested_inner_contains_outer_boundary(), test_nested_with_same_boundary():Barry Warsaw2004-05-131-0/+36
| | | | Two evil samples from Anthony's MIME torture tests.
* Another evil test from Anthony's suite. This one has an inner part with theBarry Warsaw2004-05-131-0/+83
| | | | same boundary as the outer part.
* A boiled down example from Anthony's MIME torture tests. This one has aBarry Warsaw2004-05-131-0/+101
| | | | separating boundary for an outer part inside an inner part.
* More boiled down tests from Anthony's big torture suite.Barry Warsaw2004-05-111-2/+26
|
* A boiled down message/external-body example from Anthony's torture test.Barry Warsaw2004-05-111-0/+40
|
* An example with multiple boundary lines.Barry Warsaw2004-05-111-0/+22
|
* test_mime_attachments_in_constructor(): New test to check for SF bug # 884030.Barry Warsaw2004-05-091-0/+9
|
* Like msg_12.txt but with some extra vertical whitespace around the innerBarry Warsaw2004-05-091-0/+38
| | | | message's end boundary.
* A bunch of new tests, and updated tests for the email 3.0 FeedParser.Barry Warsaw2004-05-091-63/+189
|
* test_email: comment out two fail-test cases that no longer fail with the newThomas Wouters2004-03-201-25/+27
| | | | | parser -- for now. Failure behaviour of the new parser(s) will change in any case, so this will be revisited later anyway.
* Add CJK codecs support as discussed on python-dev. (SF #873597)Hye-Shik Chang2004-01-171-7/+0
| | | | | Several style fixes are suggested by Martin v. Loewis and Marc-Andre Lemburg. Thanks!
* test_get_param_with_semis_in_quotes(): Test case for SF bug #794466.Barry Warsaw2003-09-031-0/+7
| | | | Backport candidate.
* test_rfc2231_no_language_or_charset_in_filename(),Barry Warsaw2003-08-191-0/+37
| | | | | | | | | test_rfc2231_no_language_or_charset_in_boundary(), test_rfc2231_no_language_or_charset_in_charset(): New tests for proper decoding of some RFC 2231 headers. Backport candidate (as was the Utils.py 1.25 change) to both Python 2.3.1 and 2.2.4 -- will do momentarily.
* A couple of new parsedate test cases.Barry Warsaw2003-05-081-0/+10
|
* Get rid of some hard coded tabsBarry Warsaw2003-04-241-3/+3
|
* test_whitespace_eater_unicode_2(): Test case for SF bug #710498.Barry Warsaw2003-03-301-0/+9
|
* test_long_lines_with_different_header(): Another test from Jason.Barry Warsaw2003-03-171-0/+16
|
* test_getaddresses_nasty(): A test for mimelib SF bug # 697641.Barry Warsaw2003-03-171-0/+10
|
* test_whitespace_eater_unicode(): Make this test Python 2.1 compatible.Barry Warsaw2003-03-121-1/+4
|
* Adjust tests for no newline appending to MIMEText.__init__()'s _textBarry Warsaw2003-03-111-2/+0
| | | | argument.
* Adjust tests for no newline appending to MIMEText.__init__()'s _textBarry Warsaw2003-03-111-11/+7
| | | | argument.
* test_get_decoded_uu_payload(): A new test forBarry Warsaw2003-03-111-0/+11
| | | | Content-Transfer-Encoding: x-uuencode