summaryrefslogtreecommitdiffstats
path: root/Lib/email/test/test_email.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix issue #1822: MIMEMultipart.is_multipart() behaves correctly for aFacundo Batista2008-01-191-0/+3
| | | | | just-created (and empty) instance. Added tests for this. Thanks Jonathan Share.
* In response to this SF bug:Barry Warsaw2007-07-131-0/+12
| | | | | | | | | | [ 1752723 ] email.message_from_string: initial line gets discarded I added a test to assert that when the first line of text passed to message_from_string() contains a leading space, the message ends up with the appropriate FirstHeaderLineIsContinuationDefect on its defects list. The bug is invalid.
* SF bug #1582282; decode_header() incorrectly splits not-conformant RFCBarry Warsaw2007-03-141-0/+12
| | | | | | | 2047-like headers where there is no whitespace between encoded words. This fix changes the matching regexp to include a trailing lookahead assertion that the closing ?= must be followed by whitespace, newline, or end-of-string. This also changes the regexp to add the MULTILINE flag.
* Patch #1449244: Support Unicode strings inMartin v. Löwis2007-03-131-0/+7
| | | | | email.message.Message.{set_charset,get_content_charset}. Will backport.
* Tokio Kikuchi's fix for SF bug #1629369; folding whitespace allowed in theBarry Warsaw2007-03-121-1/+7
| | | | | | | | | display name of an email address, e.g. Foo \tBar <foo@example.com> Test case added by Barry.
* Forward port some fixes that were in email 2.5 but for some reason didn't makeBarry Warsaw2006-07-261-0/+44
| | | | | | | 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-211-9/+136
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* Port forward from 2.4 branch:Barry Warsaw2006-05-011-0/+6
| | | | | | | | | | 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-031-2/+2
| | | | | | 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-181-52/+73
| | | | and NEWS updates.
* Port relevant patches for SF 1409455 to the trunk for email 3.0/Python 2.5.Barry Warsaw2006-02-081-1/+2
| | | | 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-171-1/+8
| | | | | | | | | | | 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-051-1/+43
| | | | | | | | | | | | | | | | 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).
* test_missing_start_boundary(): A test for SF bug # 1030941.Barry Warsaw2004-10-091-0/+15
|
* Big email 3.0 API changes, with updated unit tests and documentation.Barry Warsaw2004-10-031-115/+43
| | | | | | | | | | | | | | | | | 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.
* 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.
* More boiled down tests from Anthony's big torture suite.Barry Warsaw2004-05-111-2/+26
|
* test_mime_attachments_in_constructor(): New test to check for SF bug # 884030.Barry Warsaw2004-05-091-0/+9
|
* 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.
* 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-11/+7
| | | | argument.
* test_get_decoded_uu_payload(): A new test forBarry Warsaw2003-03-111-0/+11
| | | | Content-Transfer-Encoding: x-uuencode
* test_escape_backslashes(): A test for SF bug #663369 by Matthew Woodcraft.Barry Warsaw2003-03-101-0/+8
|
* Fix base classBarry Warsaw2003-03-101-1/+1
|
* Use ndiffAssertEqual in a couple of places for better error reporting.Barry Warsaw2003-03-101-3/+6
|
* test_broken_base64_payload(): Test for crash in low-level binasciiBarry Warsaw2003-03-101-0/+8
| | | | module when decoding a message with broken base64.
* test_another_long_multiline_header(): Yet another formatting test.Barry Warsaw2003-03-101-0/+12
|
* test_long_unbreakable_lines_with_continuation(): Another funky exampleBarry Warsaw2003-03-071-0/+16
| | | | from Jason Mastaler :)
* test_rfc2231_no_language_or_charset(): RFC 2231 allows leaving outBarry Warsaw2003-03-071-0/+11
| | | | both the charset and language without including any single quotes.
* whitespace normalizationBarry Warsaw2003-03-071-6/+6
|