Ejemplo n.º 1
0
def test_blackberry_signature():
    msg_body = """Heeyyoooo.
Sent wirelessly from my BlackBerry device on the Bell network.
Envoyé sans fil par mon terminal mobile BlackBerry sur le réseau de Bell."""
    eq_(('Heeyyoooo.', msg_body[len('Heeyyoooo.\n'):]),
        bruteforce.extract_signature(msg_body))

    msg_body = u"""Blah
Enviado desde mi oficina móvil BlackBerry® de Telcel"""

    eq_(('Blah', u'Enviado desde mi oficina móvil BlackBerry® de Telcel'),
        bruteforce.extract_signature(msg_body))
Ejemplo n.º 2
0
def test_blank_lines_inside_signature():
    msg_body = '''Blah.

-Lev.

Sent from my HTC smartphone!'''
    eq_(('Blah.', '-Lev.\n\nSent from my HTC smartphone!'),
        bruteforce.extract_signature(msg_body))

    msg_body = '''Blah
--

John Doe'''
    eq_(('Blah', '--\n\nJohn Doe'), bruteforce.extract_signature(msg_body))
Ejemplo n.º 3
0
def test_line_starts_with_signature_word():
    msg_body = '''Hey man!
Thanks for your attention.
--
Thanks!
Roman'''
    eq_(('Hey man!\nThanks for your attention.', '--\nThanks!\nRoman'),
        bruteforce.extract_signature(msg_body))
Ejemplo n.º 4
0
def test_line_starts_with_dashes():
    msg_body = '''Hey man!
Look at this:

--> one
--> two
--
Roman'''
    eq_(('Hey man!\nLook at this:\n\n--> one\n--> two', '--\nRoman'),
        bruteforce.extract_signature(msg_body))
Ejemplo n.º 5
0
def test_signature_max_lines_ignores_empty_lines():
    msg_body = """Thanks,
Blah

regards


John Doe"""
    eq_(('Thanks,\nBlah', 'regards\n\n\nJohn Doe'),
        bruteforce.extract_signature(msg_body))
Ejemplo n.º 6
0
def test_signature_cant_start_from_first_line():
    msg_body = """Thanks,

Blah

regards

John Doe"""
    eq_(('Thanks,\n\nBlah', 'regards\n\nJohn Doe'),
        bruteforce.extract_signature(msg_body))
Ejemplo n.º 7
0
def test_signature_separated_by_dashes():
    msg_body = '''Hey man! How r u?
---
Roman'''
    eq_(('Hey man! How r u?', '---\nRoman'),
        bruteforce.extract_signature(msg_body))

    msg_body = '''Hey!
-roman'''
    eq_(('Hey!', '-roman'), bruteforce.extract_signature(msg_body))

    msg_body = '''Hey!

- roman'''
    eq_(('Hey!', '- roman'), bruteforce.extract_signature(msg_body))

    msg_body = '''Wow. Awesome!
--
Bob Smith'''
    eq_(('Wow. Awesome!', '--\nBob Smith'),
        bruteforce.extract_signature(msg_body))
Ejemplo n.º 8
0
def test_signature_words():
    msg_body = '''Hey!

Thanks!
Roman'''
    eq_(('Hey!', 'Thanks!\nRoman'), bruteforce.extract_signature(msg_body))

    msg_body = '''Hey!
--
Best regards,

Roman'''
    eq_(('Hey!', '--\nBest regards,\n\nRoman'),
        bruteforce.extract_signature(msg_body))

    msg_body = '''Hey!
--
--
Regards,
Roman'''
    eq_(('Hey!', '--\n--\nRegards,\nRoman'),
        bruteforce.extract_signature(msg_body))
Ejemplo n.º 9
0
def test_empty_body():
    eq_(('', None), bruteforce.extract_signature(''))
Ejemplo n.º 10
0
def test_mailbox_for_iphone_signature():
    msg_body = """Blah
Sent from Mailbox for iPhone"""
    eq_(("Blah", "Sent from Mailbox for iPhone"),
        bruteforce.extract_signature(msg_body))
Ejemplo n.º 11
0
def test_iphone_signature():
    msg_body = '''Hey!

Sent from my iPhone!'''
    eq_(('Hey!', 'Sent from my iPhone!'),
        bruteforce.extract_signature(msg_body))
Ejemplo n.º 12
0
def test_signature_only():
    msg_body = '--\nRoman'
    eq_((msg_body, None), bruteforce.extract_signature(msg_body))
Ejemplo n.º 13
0
def test_crash_in_extract_signature():
    msg_body = '''Hey!
-roman'''
    eq_((msg_body, None), bruteforce.extract_signature(msg_body))
Ejemplo n.º 14
0
def test_no_signature():
    msg_body = 'Hey man!'
    eq_((msg_body, None), bruteforce.extract_signature(msg_body))
Ejemplo n.º 15
0
from talon.bruteforce import extract_signature

if __name__ == '__main__':
    print(
        extract_signature(
            "\nI just placed an order. \nDo i get credits?\nThx  \nSent from my iPhone"
        ))