make a separate test function for each language

This commit is contained in:
Jeremy Schlatter
2014-12-30 14:41:20 -08:00
parent 613d1fc815
commit 3768d7ba31

View File

@@ -98,22 +98,24 @@ bla-bla - bla"""
eq_(reply, quotations.extract_from_plain(msg_body))
def test_pattern_original_message():
languages = (
'Original Message', # English
'Reply Message',
u'Ursprüngliche Nachricht', # German
'Antwort Nachricht',
'Oprindelig meddelelse', # Danish
)
def _check_pattern_original_message(original_message_indicator):
msg_body = u"""Test reply
-----{}-----
Test"""
eq_('Test reply', quotations.extract_from_plain(msg_body.format(unicode(original_message_indicator))))
for language in languages:
eq_("Test reply", quotations.extract_from_plain(msg_body.format(unicode(language))))
def test_english_original_message():
_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():
@@ -208,8 +210,8 @@ def test_pattern_date_email_with_unicode():
eq_("Replying ok", quotations.extract_from_plain(msg_body))
def test_pattern_from_block():
english = """Allo! Follow up MIME!
def test_english_from_block():
eq_('Allo! Follow up MIME!', quotations.extract_from_plain("""Allo! Follow up MIME!
From: somebody@example.com
Sent: March-19-11 5:42 PM
@@ -217,9 +219,11 @@ To: Somebody
Subject: The manager has commented on your Loop
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
Gesendet: Dienstag, 25. November 2014 14:59
@@ -227,21 +231,19 @@ An: Somebody
Betreff: The manager has commented on your Loop
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
Sendt: 19. march 2011 12:10
Til: Somebody
Emne: The manager has commented on your Loop
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():