This repository was archived by the owner on May 17, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +60
-0
lines changed Expand file tree Collapse file tree 4 files changed +60
-0
lines changed Original file line number Diff line number Diff line change 1+ [text This is a standalone line.]
2+ [quote at 0-1 This is the first line.]
3+ [text This is a reply to the first line.]
4+ [quote at 2-3 This is the second line.]
5+ [text This is a reply to the second line.]
6+ [quote at 4-7 This is the third line.
7+
8+ This is the fourth line.]
9+ [text This is a reply to the third and fourth lines.]
Original file line number Diff line number Diff line change 1+ This is the first line.
2+
3+ This is the second line.
4+
5+ This is the third line.
6+
7+ This is the fourth line.
Original file line number Diff line number Diff line change 1+ This is a standalone line.
2+
3+ > This is the first line.
4+
5+ This is a reply to the first line.
6+
7+ > This is the second line.
8+
9+ This is a reply to the second line.
10+
11+ > This is the third line.
12+ >
13+ > This is the fourth line.
14+
15+ This is a reply to the third and fourth lines.
Original file line number Diff line number Diff line change 1+ from emailthreads import quotes
2+ import os
3+ import unittest
4+ from email .message import EmailMessage
5+
6+ class MatchBlocksTestCase (unittest .TestCase ):
7+ def _read_file (self , name ):
8+ dir_path = os .path .dirname (os .path .realpath (__file__ ))
9+ with open (dir_path + "/data/" + name , 'r' ) as f :
10+ return f .read ().strip ()
11+
12+ def _read_file_as_message (self , name ):
13+ msg = EmailMessage ()
14+ msg .set_content (self ._read_file (name ))
15+ return msg
16+
17+ def test_simple (self ):
18+ msg = self ._read_file_as_message ("simple/msg.txt" )
19+ reply = self ._read_file_as_message ("simple/reply.txt" )
20+ want = self ._read_file ("simple/blocks.txt" )
21+
22+ blocks = quotes .parse_blocks (reply )
23+ blocks = quotes .match_quotes (blocks , msg )
24+ got = "\n " .join ([str (block ) for block in blocks ])
25+
26+ self .assertEqual (got , want )
27+
28+ if __name__ == '__main__' :
29+ unittest .main ()
You can’t perform that action at this time.
0 commit comments