summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_email
Commit message (Collapse)AuthorAgeFilesLines
* Replace IOError with OSError (#16715)Andrew Svetlov2012-12-251-1/+1
|
* Close #15165: Fix test_email on Windows 64 bitsVictor Stinner2012-11-051-4/+4
| | | | Use year 1990 instead of year 1970 to avoid issues with negative timestamps.
* Closes #15925: fix regression in parsedate() and parsedate_tz() that should ↵Georg Brandl2012-09-221-2/+11
| | | | return None if unable to parse the argument.
* Merge #15249: Mangle From lines correctly when body contains invalid bytes.R David Murray2012-08-241-1/+15
| | | | Fix by Colin Su. Test by me, based on a test written by Petri Lehtinen.
* Added test for a bug fixed in issue #665194.Alexander Belopolsky2012-08-231-0/+12
|
* #665194: Update email.utils.localtime to use astimezone, and fix bug.R David Murray2012-08-231-2/+8
| | | | | | | The new code correctly handles historic changes in UTC offsets. A test for this should follow. Original patch by Alexander Belopolsky.
* Merge #15232: correctly mangle From lines in MIME preamble and epilogueR David Murray2012-07-231-0/+22
|
* #15160: Extend the new email parser to handle MIME headers.R David Murray2012-06-243-15/+905
| | | | | | | | | | | | | | | | | | | | | | | This code passes all the same tests that the existing RFC mime header parser passes, plus a bunch of additional ones. There are a couple of commented out tests where there are issues with the folding. The folding doesn't normally get invoked for headers parsed from source, and the cases are marginal anyway (headers with invalid binary data) so I'm not worried about them, but will fix them after the beta. There are things that can be done to make this API even more convenient, but I think this is a solid foundation worth having. And the parser is a full RFC parser, so it handles cases that the current parser doesn't. (There are also probably cases where it fails when the current parser doesn't, but I haven't found them yet ;) Oh, yeah, and there are some really ugly bits in the parser for handling some 'postel' cases that are unfortunately common. I hope/plan to to eventually refactor a lot of the code in the parser which should reduce the line count...but there is no escaping the fact that the error recovery is welter of special cases.
* Issue #14653: email.utils.mktime_tz() no longer relies on systemAlexander Belopolsky2012-06-221-0/+6
| | | | mktime() when timezone offest is supplied.
* #2658: Add test for issue fixed by fix for #1079.R David Murray2012-06-031-0/+10
|
* #1079: Fix parsing of encoded words.R David Murray2012-06-022-14/+67
| | | | | | | | | This is a behavior change: before this leading and trailing spaces were stripped from ASCII parts, now they are preserved. Without this fix we didn't parse the examples in the RFC correctly, so I think breaking backward compatibility here is justified. Patch by Ralf Schlatterbeck.
* Don't use metaclasses when class decorators can do the job.R David Murray2012-05-314-41/+44
| | | | | Thanks to Nick Coghlan for pointing out that I'd forgotten about class decorators.
* Make parameterized tests in email less hackish.R David Murray2012-05-314-93/+122
| | | | | Or perhaps more hackish, depending on your perspective. But at least this way it is now possible to run the individual tests using the unittest CLI.
* #10839: add new test file that was omitted from checkinR David Murray2012-05-291-0/+18
|
* Refactor test_email/test_pickleable and add tests for date headersR David Murray2012-05-291-28/+59
|
* Regularize test_email/test_headerregistry's references to policy.R David Murray2012-05-291-6/+6
|
* Refactor test_email/test_defect_handling.R David Murray2012-05-292-179/+162
|
* #12515: email now registers a defect if the MIME end boundary is missing.R David Murray2012-05-281-0/+33
| | | | | | This commit also restores the news item for 167256 that it looks like Terry inadvertently deleted. (Either that, or I don't understand now merging works...which is equally possible.)
* #1672568: email now registers defects for base64 payload format errors.R David Murray2012-05-283-268/+324
| | | | | | | | | | | | | | | Which also means that it is now producing *something* for any base64 payload, which is what leads to the couple of older test changes in test_email. This is a slightly backward incompatible behavior change, but the new behavior is so much more useful than the old (you can now *reliably* detect errors, and any program that was detecting errors by sniffing for a base64 return from get_payload(decode=True) and then doing its own error-recovery decode will just get the error-recovery decode right away). So this seems to me to be worth the small risk inherent in this behavior change. This patch also refactors the defect tests into a separate test file, since they are no longer just parser tests.
* #14925: email now registers a defect for missing header/body separator.R David Murray2012-05-282-11/+39
| | | | | | | This patch also deprecates the MalformedHeaderDefect. My best guess is that this defect was rendered obsolete by a refactoring of the parser, and the corresponding defect for the new parser (which this patch introduces) was overlooked.
* Make headerregistry fully part of the provisional api.R David Murray2012-05-273-36/+35
| | | | | | | | | | | | | When I made the checkin of the provisional email policy, I knew that Address and Group needed to be made accessible from somewhere. The more I looked at it, though, the more it became clear that since this is a provisional API anyway, there's no good reason to hide headerregistry as a private API. It was designed to ultimately be part of the public API, and so it should be part of the provisional API. This patch fully documents the headerregistry API, and deletes the abbreviated version of those docs I had added to the provisional policy docs.
* Recognize '<>' as a special case of an angle-addr in header_value_parser.R David Murray2012-05-261-1/+14
| | | | | | | Although '<>' is invalid according to RFC 5322, SMTP uses it for various things, and it sometimes ends up in email headers. This patch changes get_angle_addr to recognize it and just register a Defect instead of raising a parsing error.
* #665194: Add a localtime function to email.utils.R David Murray2012-05-261-0/+73
| | | | | | | | Without this function people would be tempted to use the other date functions in email.utils to compute an aware localtime, and those functions are not as good for that purpose as this code. The code is Alexander Belopolsy's from his proposed patch for issue 9527, with a fix (and additional tests) by Brian K. Jones.
* #12586: Fix a small oversight in the new email policy header setting code.R David Murray2012-05-261-0/+22
| | | | | This is a danger of focusing on unit tests: sometimes you forget to do the integration tests.
* #12586: add provisional email policy with new header parsing and folding.R David Murray2012-05-257-105/+3624
| | | | | | | | | | | | | | When the new policies are used (and only when the new policies are explicitly used) headers turn into objects that have attributes based on their parsed values, and can be set using objects that encapsulate the values, as well as set directly from unicode strings. The folding algorithm then takes care of encoding unicode where needed, and folding according to the highest level syntactic objects. With this patch only date and time headers are parsed as anything other than unstructured, but that is all the helper methods in the existing API handle. I do plan to add more parsers, and complete the set specified in the RFC before the package becomes stable.
* #14731: refactor email policy framework.R David Murray2012-05-255-155/+514
| | | | | | | | | | | | | | | | | This patch primarily does two things: (1) it adds some internal-interface methods to Policy that allow for Policy to control the parsing and folding of headers in such a way that we can construct a backward compatibility policy that is 100% compatible with the 3.2 API, while allowing a new policy to implement the email6 API. (2) it adds that backward compatibility policy and refactors the test suite so that the only differences between the 3.2 test_email.py file and the 3.3 test_email.py file is some small changes in test framework and the addition of tests for bugs fixed that apply to the 3.2 API. There are some additional teaks, such as moving just the code needed for the compatibility policy into _policybase, so that the library code can import only _policybase. That way the new code that will be added for email6 will only get imported when a non-compatibility policy is imported.
* #14380: Make actual default match docs, fix __init__ order.R David Murray2012-03-231-2/+1
| | | | | | | | Éric pointed out that given that the default was documented as None, someone would reasonably pass that to get the default behavior. In fixing the code to use None, I noticed that the change to _charset was being done after it had already been passed to MIMENonMultipart. The change to the test verifies that the order is now correct.
* #14380: Have MIMEText defaults to utf-8 when passed non-ASCII unicodeR David Murray2012-03-231-1/+14
| | | | | | | Previously it would just accept the unicode, which would wind up as unicode in the transfer-encoded message object, which is just wrong. Patch by Jeff Knupp.
* Merge #11686: add missing entries to email __all__ lists.R David Murray2012-03-171-8/+5
| | | | Original patch by Steffen Daode Nurpmeso
* #12788: fix error in test_policy when run under refleak detectionR David Murray2012-03-171-1/+3
|
* #12818: remove escaping of () in quoted strings in formataddrR David Murray2012-03-141-1/+13
| | | | | The quoting of ()s inside quoted strings is allowed by the RFC, but is not needed. There seems to be no reason to add needless escapes.
* #14062: fix BytesParser handling of Header objectsR David Murray2012-03-141-0/+24
| | | | | | This is a different fix than the 3.2 fix, but the new tests are the same. This also affected smtplib.SMTP.send_message, which calls BytesParser.
* Merge #14291: if a header has non-ascii unicode, default to CTE using utf-8R David Murray2012-03-141-2/+19
| | | | | | | | | | | | | | In Python2, if a unicode string was assigned as the value of a header, email would automatically CTE encode it using the UTF8 charset. This capability was lost in the Python3 translation, and this patch restores it. Patch by Ali Ikinci, assisted by R. David Murray. I also added a fix for the mailbox test that was depending (with a comment that it was a bad idea to so depend) on non-ASCII causing message_from_string to raise an error. It now uses support.patch to induce an error during message serialization.
* #8315: add automatic unittest test discovery in test.test_emailR David Murray2012-03-131-0/+10
|
* #13012: use splitlines(keepends=True/False) instead of splitlines(0/1).Ezio Melotti2011-09-281-1/+1
|
* #665194: support roundtripping RFC2822 date stamps in the email.utils moduleR David Murray2011-07-201-0/+45
|
* #1874: detect invalid multipart CTE and report it as a defect.R David Murray2011-06-221-0/+45
|
* merge #11584: make Header and make_header handle binary unknown-8bit inputR David Murray2011-06-181-0/+15
|
* merge #11584: make decode_header handle Header objects correctlyR David Murray2011-06-181-2/+2
| | | | | This updates 12e39cd7a0e4 (merge of b21fdfa0019c), which fixed this bug incorrectly.
* #11731: simplify/enhance parser/generator API by introducing policy objects.R David Murray2011-04-184-15/+415
| | | | | | | | This new interface will also allow for future planned enhancements in control over the parser/generator without requiring any additional complexity in the parser/generator API. Patch reviewed by Éric Araujo and Barry Warsaw.
* Merge: #11492: rewrite header folding algorithm. Less code, more passing tests.R David Murray2011-04-181-17/+132
|
* Merge: Improve message.py test coverage to 100%.R David Murray2011-04-161-0/+56
| | | | | coverage.py reports 99% on branch coverage, but that appears to be a bug or limitation in coverage.py.
* #11684: Complete parser bytes interface by adding BytesHeaderParserR David Murray2011-04-131-0/+24
| | | | Patch by Steffen Daode Nurpmeso.
* Use stock assertEqual instead of custom ndiffAssertEqual.R David Murray2011-04-101-9/+1
| | | | Eventually I'll actually replace the calls in the tests themselves.
* Merge #11492: fix header truncation on folding when there are runs of split ↵R David Murray2011-04-081-0/+10
| | | | | | chars. Not a complete fix for this issue.
* Merge: Improve test coverage of _split_ascii method.R David Murray2011-04-081-0/+43
|
* #1690608: make formataddr RFC2047 aware.R David Murray2011-04-061-0/+40
| | | | Patch by Torsten Becker.
* Merge #11605: don't use set/get_payload in feedparser; they do conversions.R David Murray2011-04-061-0/+47
|
* Move assertBytesEqual to base test class, improve it, and hook into assertEqualR David Murray2011-03-312-6/+12
|
* Move infrastructure into __init__ to lay groundwork for splitting test_email.R David Murray2011-03-312-27/+28
| | | | | The split probably won't happen for a while, but I might as well lay the groundwork now since I'll be adding new test modules before too long.