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 <*****@*****.**>") == [ "*****@*****.**" ]
def emails_from_title(self): if self.title: return extract_emails_from_text(self.title) else: return []
def emails_from_description(self): if self.description: return extract_emails_from_text(self.description) else: return []