make a separate test function for each language
This commit is contained in:
@@ -98,22 +98,24 @@ bla-bla - bla"""
|
|||||||
eq_(reply, quotations.extract_from_plain(msg_body))
|
eq_(reply, quotations.extract_from_plain(msg_body))
|
||||||
|
|
||||||
|
|
||||||
def test_pattern_original_message():
|
def _check_pattern_original_message(original_message_indicator):
|
||||||
languages = (
|
|
||||||
'Original Message', # English
|
|
||||||
'Reply Message',
|
|
||||||
u'Ursprüngliche Nachricht', # German
|
|
||||||
'Antwort Nachricht',
|
|
||||||
'Oprindelig meddelelse', # Danish
|
|
||||||
)
|
|
||||||
msg_body = u"""Test reply
|
msg_body = u"""Test reply
|
||||||
|
|
||||||
-----{}-----
|
-----{}-----
|
||||||
|
|
||||||
Test"""
|
Test"""
|
||||||
|
eq_('Test reply', quotations.extract_from_plain(msg_body.format(unicode(original_message_indicator))))
|
||||||
|
|
||||||
for language in languages:
|
def test_english_original_message():
|
||||||
eq_("Test reply", quotations.extract_from_plain(msg_body.format(unicode(language))))
|
_check_pattern_original_message('Original Message')
|
||||||
|
_check_pattern_original_message('Reply Message')
|
||||||
|
|
||||||
|
def test_german_original_message():
|
||||||
|
_check_pattern_original_message(u'Ursprüngliche Nachricht')
|
||||||
|
_check_pattern_original_message('Antwort Nachricht')
|
||||||
|
|
||||||
|
def test_danish_original_message():
|
||||||
|
_check_pattern_original_message('Oprindelig meddelelse')
|
||||||
|
|
||||||
|
|
||||||
def test_reply_after_quotations():
|
def test_reply_after_quotations():
|
||||||
@@ -208,8 +210,8 @@ def test_pattern_date_email_with_unicode():
|
|||||||
eq_("Replying ok", quotations.extract_from_plain(msg_body))
|
eq_("Replying ok", quotations.extract_from_plain(msg_body))
|
||||||
|
|
||||||
|
|
||||||
def test_pattern_from_block():
|
def test_english_from_block():
|
||||||
english = """Allo! Follow up MIME!
|
eq_('Allo! Follow up MIME!', quotations.extract_from_plain("""Allo! Follow up MIME!
|
||||||
|
|
||||||
From: somebody@example.com
|
From: somebody@example.com
|
||||||
Sent: March-19-11 5:42 PM
|
Sent: March-19-11 5:42 PM
|
||||||
@@ -217,9 +219,11 @@ To: Somebody
|
|||||||
Subject: The manager has commented on your Loop
|
Subject: The manager has commented on your Loop
|
||||||
|
|
||||||
Blah-blah-blah
|
Blah-blah-blah
|
||||||
"""
|
"""))
|
||||||
|
|
||||||
german = """Allo! Follow up MIME!
|
def test_german_from_block():
|
||||||
|
eq_('Allo! Follow up MIME!', quotations.extract_from_plain(
|
||||||
|
"""Allo! Follow up MIME!
|
||||||
|
|
||||||
Von: somebody@example.com
|
Von: somebody@example.com
|
||||||
Gesendet: Dienstag, 25. November 2014 14:59
|
Gesendet: Dienstag, 25. November 2014 14:59
|
||||||
@@ -227,21 +231,19 @@ An: Somebody
|
|||||||
Betreff: The manager has commented on your Loop
|
Betreff: The manager has commented on your Loop
|
||||||
|
|
||||||
Blah-blah-blah
|
Blah-blah-blah
|
||||||
"""
|
"""))
|
||||||
|
|
||||||
danish = """Allo! Follow up MIME!
|
def test_danish_from_block():
|
||||||
|
eq_('Allo! Follow up MIME!', quotations.extract_from_plain(
|
||||||
|
"""Allo! Follow up MIME!
|
||||||
|
|
||||||
Fra: somebody@example.com
|
Fra: somebody@example.com
|
||||||
Sendt: 19. march 2011 12:10
|
Sendt: 19. march 2011 12:10
|
||||||
Til: Somebody
|
Til: Somebody
|
||||||
Emne: The manager has commented on your Loop
|
Emne: The manager has commented on your Loop
|
||||||
|
|
||||||
|
|
||||||
Blah-blah-blah
|
Blah-blah-blah
|
||||||
"""
|
"""))
|
||||||
|
|
||||||
for language in (english, german, danish):
|
|
||||||
eq_("Allo! Follow up MIME!", quotations.extract_from_plain(language))
|
|
||||||
|
|
||||||
|
|
||||||
def test_quotation_marker_false_positive():
|
def test_quotation_marker_false_positive():
|
||||||
|
|||||||
Reference in New Issue
Block a user