diff options
author | R David Murray <rdmurray@bitdance.com> | 2011-04-08 00:37:17 (GMT) |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2011-04-08 00:37:17 (GMT) |
commit | 7da4db118e7899a64ef3b315f63c37ec0dbd2253 (patch) | |
tree | a1f0485482ce8362296416b251311cf2f960c859 /Lib/email | |
parent | 88e194513e60853f7074d8f0fbca75d987a7a124 (diff) | |
download | cpython-7da4db118e7899a64ef3b315f63c37ec0dbd2253.zip cpython-7da4db118e7899a64ef3b315f63c37ec0dbd2253.tar.gz cpython-7da4db118e7899a64ef3b315f63c37ec0dbd2253.tar.bz2 |
Improve test coverage of _split_ascii method.
Diffstat (limited to 'Lib/email')
-rw-r--r-- | Lib/email/test/test_email.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/Lib/email/test/test_email.py b/Lib/email/test/test_email.py index d602913..5b8b7bf 100644 --- a/Lib/email/test/test_email.py +++ b/Lib/email/test/test_email.py @@ -750,6 +750,49 @@ References: <0@dom.ain> <1@dom.ain> <2@dom.ain> <3@dom.ain> <4@dom.ain> Test""") + def test_last_split_chunk_does_not_fit(self): + eq = self.ndiffAssertEqual + h = Header('Subject: the first part of this is short, but_the_second' + '_part_does_not_fit_within_maxlinelen_and_thus_should_be_on_a_line' + '_all_by_itself') + eq(h.encode(), """\ +Subject: the first part of this is short, + but_the_second_part_does_not_fit_within_maxlinelen_and_thus_should_be_on_a_line_all_by_itself""") + + def test_splittable_leading_char_followed_by_overlong_unsplitable(self): + eq = self.ndiffAssertEqual + h = Header(', but_the_second' + '_part_does_not_fit_within_maxlinelen_and_thus_should_be_on_a_line' + '_all_by_itself') + eq(h.encode(), """\ +, + but_the_second_part_does_not_fit_within_maxlinelen_and_thus_should_be_on_a_line_all_by_itself""") + + def test_multiple_splittable_leading_char_followed_by_overlong_unsplitable(self): + eq = self.ndiffAssertEqual + h = Header(', , but_the_second' + '_part_does_not_fit_within_maxlinelen_and_thus_should_be_on_a_line' + '_all_by_itself') + eq(h.encode(), """\ +, , + but_the_second_part_does_not_fit_within_maxlinelen_and_thus_should_be_on_a_line_all_by_itself""") + + def test_trailing_splitable_on_overlong_unsplitable(self): + eq = self.ndiffAssertEqual + h = Header('this_part_does_not_fit_within_maxlinelen_and_thus_should_' + 'be_on_a_line_all_by_itself;') + eq(h.encode(), "this_part_does_not_fit_within_maxlinelen_and_thus_should_" + "be_on_a_line_all_by_itself;") + + def test_trailing_splitable_on_overlong_unsplitable_with_leading_splitable(self): + eq = self.ndiffAssertEqual + h = Header('; ' + 'this_part_does_not_fit_within_maxlinelen_and_thus_should_' + 'be_on_a_line_all_by_itself;') + eq(h.encode(), """\ +; + this_part_does_not_fit_within_maxlinelen_and_thus_should_be_on_a_line_all_by_itself;""") + def test_no_split_long_header(self): eq = self.ndiffAssertEqual hstr = 'References: ' + 'x' * 80 |