-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle case where slice_tree receives (start, end) slice with end <= …
…start.
- Loading branch information
Showing
2 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -293,6 +293,26 @@ def test_gmail_forward(self): | |
'text': 'Spanish Classes\nLearn Spanish', | ||
}) | ||
|
||
def test_gmail_forward_no_message(self): | ||
# No more Hello message at the beginning, unlike test_gmail_forward | ||
self.assertEqual(unwrap(""" | ||
---------- Forwarded message ---------- | ||
From: Someone <[email protected]> | ||
Date: Fri, Apr 26, 2013 at 8:13 PM | ||
Subject: Weekend Spanish classes | ||
To: [email protected] | ||
Spanish Classes | ||
Learn Spanish | ||
"""), { | ||
'type': 'forward', | ||
'from': 'Someone <[email protected]>', | ||
'date': 'Fri, Apr 26, 2013 at 8:13 PM', | ||
'subject': 'Weekend Spanish classes', | ||
'to': '[email protected]', | ||
'text': 'Spanish Classes\nLearn Spanish', | ||
}) | ||
|
||
def test_apple_forward(self): | ||
# Apple Mail (10.9 and earlier) forward | ||
self.assertEqual(unwrap("""Hello | ||
|
@@ -702,6 +722,32 @@ def test_gmail_forward(self): | |
'html': '<html><head></head><body><div dir="ltr"><div><div class="gmail_quote"><div dir="ltr">Some text</div></div></div></div></body></html>', | ||
}) | ||
|
||
def test_gmail_forward_no_message(self): | ||
html = ''' | ||
<html> | ||
<head></head> | ||
<body> | ||
<div dir="ltr"> | ||
<div><br><div class="gmail_quote">---------- Forwarded message ----------<br> | ||
From: <b class="gmail_sendername">Foo Bar</b> <span dir="ltr"><<a href="mailto:[email protected]">[email protected]</a>></span><br> | ||
Date: Thu, Mar 24, 2016 at 5:17 PM<br> | ||
Subject: The Subject<br> | ||
To: John Doe <<a href="mailto:[email protected]">[email protected]</a>><br><br><br> | ||
<div dir="ltr">Some text<div><br></div><div><br></div></div></div><br> | ||
</div> | ||
</div> | ||
</body> | ||
</html>''' | ||
|
||
self.assertEqual(unwrap_html(html), { | ||
'type': 'forward', | ||
'subject': 'The Subject', | ||
'date': 'Thu, Mar 24, 2016 at 5:17 PM', | ||
'from': 'Foo Bar <[email protected]>', | ||
'to': 'John Doe <[email protected]>', | ||
'html': '<html><head></head>\n <body><div dir="ltr"><div><div class="gmail_quote"><div dir="ltr">Some text</div></div></div></div></body></html>', | ||
}) | ||
|
||
def test_apple_reply(self): | ||
html = '<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Foo<div class=""><br class=""></div><div class="">Bar</div><div class=""><br class=""></div><div class=""><div><blockquote type="cite" class=""><div class="">On 2016-03-25, at 23:01, John Doe <<a href="mailto:[email protected]" class="">[email protected]</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Some <b class="">important</b> email<br class=""></div></div></blockquote></div><br class=""></div></body></html>' | ||
|
||
|