コード例 #1
0
ファイル: test_util.py プロジェクト: ivicac/sync-engine
def test_extract_emails_from_text():
    assert extract_emails_from_text("*****@*****.**") == ["*****@*****.**"]
    assert extract_emails_from_text("foo#[email protected]#foo") == [
        "foo#[email protected]"
    ]
    assert extract_emails_from_text('email="*****@*****.**"') == [
        "*****@*****.**"
    ]
    assert extract_emails_from_text(
        '<a href="mailto:[email protected]">Email</a>') == ["*****@*****.**"]
    assert extract_emails_from_text("The email is [email protected].") == [
        "*****@*****.**"
    ]
    assert extract_emails_from_text(u"Email b\[email protected]\xe4mple.com") == [
        u"b\[email protected]\xe4mple.com"
    ]
    assert extract_emails_from_text(
        "Multiple\[email protected]\[email protected]\nemails") == [
            "*****@*****.**", "*****@*****.**"
        ]
    assert extract_emails_from_text("Email <*****@*****.**>") == [
        "*****@*****.**"
    ]
コード例 #2
0
 def emails_from_title(self):
     if self.title:
         return extract_emails_from_text(self.title)
     else:
         return []
コード例 #3
0
 def emails_from_description(self):
     if self.description:
         return extract_emails_from_text(self.description)
     else:
         return []