From 02adf53ab97c21b50cbaaf3d032bf70871829d24 Mon Sep 17 00:00:00 2001 From: Sergey Obukhov Date: Fri, 4 Mar 2016 13:14:50 -0800 Subject: [PATCH] fixes mailgun/talon#12 --- setup.py | 2 +- talon/quotations.py | 4 +++- tests/text_quotations_test.py | 13 +++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 4d542710..11b00839 100755 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup(name='talon', - version='1.2.4', + version='1.2.5', description=("Mailgun library " "to extract message quotations and signatures."), long_description=open("README.rst").read(), diff --git a/talon/quotations.py b/talon/quotations.py index 4687f8f9..ff23daaf 100644 --- a/talon/quotations.py +++ b/talon/quotations.py @@ -148,7 +148,9 @@ re.compile("\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}\s+GMT.*@", re.S), # Thu, 26 Jun 2014 14:00:51 +0400 Bob : re.compile('\S{3,10}, \d\d? \S{3,10} 20\d\d,? \d\d?:\d\d(:\d\d)?' - '( \S+){3,6}@\S+:') + '( \S+){3,6}@\S+:'), + # Sent from Samsung MobileName wrote: + re.compile('Sent from Samsung .*@.*> wrote') ] diff --git a/tests/text_quotations_test.py b/tests/text_quotations_test.py index a4655d98..70e1bfa9 100644 --- a/tests/text_quotations_test.py +++ b/tests/text_quotations_test.py @@ -32,6 +32,19 @@ def test_pattern_on_date_somebody_wrote(): eq_("Test reply", quotations.extract_from_plain(msg_body)) +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)) + + def test_pattern_on_date_wrote_somebody(): eq_('Lorem', quotations.extract_from_plain( """Lorem