Exemple #1
0
def test_different_marker_func():
    assert emails(
        '*****@*****.**',
        lambda a, b: u'<{}|{}>'.format(a, b)
    ) == '<mailto:[email protected]|[email protected]>'

    assert emails(
        'mailto:[email protected]',
        lambda a, b: u'<{}|{}>'.format(a, b)
    ) == '<mailto:[email protected]|mailto:[email protected]>'
Exemple #2
0
def test_whole_message():
    text = u"""Hey!

Here is the address: test.com which should give
you what you want,
there is also [email protected] and [email protected] if you need.

We can also try mailto:[email protected], mailto:[email protected] or hej@håkan.com?
"""

    new_text = emails(text)

    expected_text = u"""Hey!

Here is the address: test.com which should give
you what you want,
there is also <mailto:[email protected]> and <mailto:[email protected]> if you need.

We can also try <mailto:[email protected]>, <mailto:[email protected]> or <mailto:hej@håkan.com>?
"""

    assert new_text == expected_text
Exemple #3
0
def test_tlds():
    for tld in TLDs():
        assert emails(u'test@example.{}'.format(tld)) == u'<mailto:test@example.{}>'.format(tld)
Exemple #4
0
def test_email_vs_url():
    assert emails('example.com') == 'example.com'
    assert emails('*****@*****.**') == '<mailto:[email protected]>'
Exemple #5
0
def test_co_uk():
    assert emails('*****@*****.**') == '<mailto:[email protected]>'
Exemple #6
0
def test_unknown_tld():
    assert emails('*****@*****.**') == '*****@*****.**'
Exemple #7
0
def test_excludes_after_domain():
    assert emails('[email protected]?') == '<mailto:[email protected]>?'
Exemple #8
0
def test_unicode():
    assert emails(u'рф@кто.рф') == u'<mailto:рф@кто.рф>'
Exemple #9
0
def test_must_start_with_word_character():
    assert emails('*****@*****.**') == '*****@*****.**'
Exemple #10
0
def test_keep_mailto():
    assert emails('mailto:[email protected]') == '<mailto:[email protected]>'
Exemple #11
0
def test_add_mailto():
    assert emails('*****@*****.**') == '<mailto:[email protected]>'