Пример #1
0
def test_link_breaks_quotation_markers_sequence():
    # link starts and ends on the same line
    msg_body = """Blah

On Thursday, October 25, 2012 at 3:03 PM, life is short. on Bob wrote:

>
> Post a response by replying to this email
>
 (http://example.com/c/YzOTYzMmE) >
> life is short. (http://example.com/c/YzMmE)
>
"""
    eq_("Blah", quotations.extract_from_plain(msg_body))

    # link starts after some text on one line and ends on another
    msg_body = """Blah

On Monday, 24 September, 2012 at 3:46 PM, bob wrote:

> [Ticket #50] test from bob
>
> View ticket (http://example.com/action
_nonce=3dd518)
>
"""
    eq_("Blah", quotations.extract_from_plain(msg_body))
Пример #2
0
def test_norwegian_from_line():
    eq_('Lorem', quotations.extract_from_plain(
    u"""Lorem
På 14 september 2015 på 02:23:18, Valentino Rudy ([email protected]) skrev:

Veniam laborum mlkshk kale chips authentic. Normcore mumblecore laboris, fanny pack readymade eu blog chia pop-up freegan enim master cleanse.
"""))
Пример #3
0
def test_french_from_block():
    eq_('Lorem ipsum', quotations.extract_from_plain(
    u"""Lorem ipsum

Le 23 janv. 2015 à 22:03, Brendan xxx <[email protected]<mailto:[email protected]>> a écrit:

Bonjour!"""))
Пример #4
0
def test_short_quotation():
    msg_body = """Hi

On 04/19/2011 07:10 AM, Roman Tkachenko wrote:

> Hello"""
    eq_("Hi", quotations.extract_from_plain(msg_body))
Пример #5
0
def test_reply_after_quotations():
    msg_body = """On 04/19/2011 07:10 AM, Roman Tkachenko wrote:

>
> Test
Test reply"""
    eq_("Test reply", quotations.extract_from_plain(msg_body))
Пример #6
0
def test_too_many_lines():
    msg_body = """Test reply
Hi
-----Original Message-----

Test"""
    eq_("Test reply", quotations.extract_from_plain(msg_body))
Пример #7
0
def test_appointment():
    msg_body = """Response

10/19/2017 @ 9:30 am for physical therapy
Bla
1517 4th Avenue Ste 300
London CA 19129, 555-421-6780

John Doe, FCLS
Mailgun Inc
555-941-0697

From: [email protected] [mailto:[email protected]]
Sent: Wednesday, October 18, 2017 2:05 PM
To: John Doer - SIU <*****@*****.**>
Subject: RE: Claim # 5551188-1

Text"""

    expected = """Response

10/19/2017 @ 9:30 am for physical therapy
Bla
1517 4th Avenue Ste 300
London CA 19129, 555-421-6780

John Doe, FCLS
Mailgun Inc
555-941-0697"""
    eq_(expected, quotations.extract_from_plain(msg_body))
Пример #8
0
def test_pattern_on_date_wrote_somebody():
    eq_('Lorem', quotations.extract_from_plain(
    """Lorem

Op 13-02-2014 3:18 schreef Julius Caesar <*****@*****.**>:

Veniam laborum mlkshk kale chips authentic. Normcore mumblecore laboris, fanny pack readymade eu blog chia pop-up freegan enim master cleanse.
"""))
Пример #9
0
def test_with_indent():
    msg_body = """YOLO salvia cillum kogi typewriter mumblecore cardigan skateboard Austin.

------On 12/29/1987 17:32 PM, Julius Caesar wrote-----

Brunch mumblecore pug Marfa tofu, irure taxidermy hoodie readymade pariatur.
    """
    eq_("YOLO salvia cillum kogi typewriter mumblecore cardigan skateboard Austin.", quotations.extract_from_plain(msg_body))
Пример #10
0
def test_dutch_from_block():
    eq_('Gluten-free culpa lo-fi et nesciunt nostrud.', quotations.extract_from_plain(
    """Gluten-free culpa lo-fi et nesciunt nostrud.

Op 17-feb.-2015, om 13:18 heeft Julius Caesar <*****@*****.**> het volgende geschreven:

Small batch beard laboris tempor, non listicle hella Tumblr heirloom.
"""))
Пример #11
0
def _check_pattern_original_message(original_message_indicator):
    msg_body = u"""Test reply

-----{}-----

Test"""
    eq_('Test reply', quotations.extract_from_plain(
        msg_body.format(six.text_type(original_message_indicator))))
Пример #12
0
def test_vietnamese_from_block():
    eq_('Hello', quotations.extract_from_plain(
    u"""Hello

Vào 14:24 8 tháng 6, 2017, Hùng Nguyễn <*****@*****.**> đã viết:

> Xin chào
"""))
Пример #13
0
def test_polish_from_block():
    eq_('Lorem ipsum', quotations.extract_from_plain(
    u"""Lorem ipsum

W dniu 28 stycznia 2015 01:53 użytkownik Zoe xxx <*****@*****.**>
napisał:

Blah!
"""))
Пример #14
0
def test_weird_date_format_in_date_block():
    msg_body = """Blah
Date: Fri=2C 28 Sep 2012 10:55:48 +0000
From: [email protected]
To: [email protected]
Subject: [Ticket #8] Test

"""
    eq_('Blah', quotations.extract_from_plain(msg_body))
Пример #15
0
def test_android_wrote():
    msg_body = """Test reply

---- John Smith wrote ----

> quoted
> text
"""
    eq_("Test reply", quotations.extract_from_plain(msg_body))
Пример #16
0
def test_pattern_on_date_somebody_wrote_allows_space_in_front():
    msg_body = """Thanks Thanmai
 On Mar 8, 2012 9:59 AM, "Example.com" <
*****@*****.**> wrote:


>**
>  Blah-blah-blah"""
    eq_("Thanks Thanmai", quotations.extract_from_plain(msg_body))
Пример #17
0
def test_quotation_separator_takes_3_lines():
    msg_body = """Test reply

On Nov 30, 2011, at 12:47 PM, Somebody <
*****@*****.**>
wrote:

Test message
"""
    eq_("Test reply", quotations.extract_from_plain(msg_body))
Пример #18
0
def test_english_from_block():
    eq_('Allo! Follow up MIME!', quotations.extract_from_plain("""Allo! Follow up MIME!

From: [email protected]
Sent: March-19-11 5:42 PM
To: Somebody
Subject: The manager has commented on your Loop

Blah-blah-blah
"""))
Пример #19
0
def test_link_closed_with_quotation_marker_on_new_line():
    msg_body = '''8.45am-1pm

From: [email protected]

<http://email.example.com/c/dHJhY2tpbmdfY29kZT1mMDdjYzBmNzM1ZjYzMGIxNT
>  <[email protected] <mailto:[email protected]> >

Requester: '''
    eq_('8.45am-1pm', quotations.extract_from_plain(msg_body))
Пример #20
0
def test_swedish_from_block():
    eq_('Allo! Follow up MIME!', quotations.extract_from_plain(
    u"""Allo! Follow up MIME!
Från: Anno Sportel [mailto:[email protected]]
Skickat: den 26 augusti 2015 14:45
Till: Isacson Leiff
Ämne: RE: Week 36

Blah-blah-blah
"""))
Пример #21
0
def test_pattern_on_date_somebody_sent():
    msg_body = """Test reply

On 11-Apr-2011, at 6:54 PM, Roman Tkachenko <*****@*****.**> sent:

>
> Test
>
> Roman"""
    eq_("Test reply", quotations.extract_from_plain(msg_body))
Пример #22
0
def test_feedback_below_left_unparsed():
    msg_body = """Please enter your feedback below. Thank you.

------------------------------------- Enter Feedback Below -------------------------------------

The user experience was unparallelled. Please continue production. I'm sending payment to ensure
that this line is intact."""

    parsed = quotations.extract_from_plain(msg_body)
    eq_(msg_body, parsed)
Пример #23
0
def test_date_time_email_splitter():
    msg_body = """Test reply

2014-10-17 11:28 GMT+03:00 Postmaster <
*****@*****.**>:

> First from site
>
    """
    eq_("Test reply", quotations.extract_from_plain(msg_body))
Пример #24
0
def test_pattern_on_date_somebody_wrote_date_with_slashes():
    msg_body = """Test reply

On 04/19/2011 07:10 AM, Roman Tkachenko wrote:

>
> Test.
>
> Roman"""
    eq_("Test reply", quotations.extract_from_plain(msg_body))
Пример #25
0
def test_german_from_block():
    eq_('Allo! Follow up MIME!', quotations.extract_from_plain(
    """Allo! Follow up MIME!

Von: [email protected]
Gesendet: Dienstag, 25. November 2014 14:59
An: Somebody
Betreff: The manager has commented on your Loop

Blah-blah-blah
"""))
Пример #26
0
def test_french_multiline_from_block():
    eq_('Lorem ipsum', quotations.extract_from_plain(
    u"""Lorem ipsum

De : Brendan xxx [mailto:[email protected]]
Envoyé : vendredi 23 janvier 2015 16:39
À : Camille XXX
Objet : Follow Up

Blah-blah-blah
"""))
Пример #27
0
def test_pattern_sent_from_samsung_smb_wrote():
    msg_body = """Test reply

Sent from Samsung MobileName <*****@*****.**> wrote:

>
> Test
>
> Roman"""

    eq_("Test reply", quotations.extract_from_plain(msg_body))
Пример #28
0
def test_bold_from_block():
    msg_body = """Hi

  *From:* [email protected] [mailto:
  [email protected]]
  *Sent:* Wednesday, June 27, 2012 3:05 PM
  *To:* [email protected]
  *Subject:* Hello

"""
    eq_("Hi", quotations.extract_from_plain(msg_body))
Пример #29
0
def test_danish_from_block():
    eq_('Allo! Follow up MIME!', quotations.extract_from_plain(
    """Allo! Follow up MIME!

Fra: [email protected]
Sendt: 19. march 2011 12:10
Til: Somebody
Emne: The manager has commented on your Loop

Blah-blah-blah
"""))
Пример #30
0
def test_dont_parse_quotations_for_forwarded_messages():
    msg_body = """FYI

---------- Forwarded message ----------
From: [email protected]
Date: Tue, Sep 4, 2012 at 1:35 PM
Subject: Two
line subject
To: [email protected]

Text"""
    eq_(msg_body, quotations.extract_from_plain(msg_body))