예제 #1
0
def parse(file: str, endswith: Optional[str]) -> None:
    """Parse given file for emails."""

    with open(file, mode="r", encoding="utf-8") as f:
        for line in f:
            for email in parse_emails(line):
                if endswith and not email.endswith(endswith):
                    continue

                click.echo(email)
예제 #2
0
def test_parse_email_sql() -> None:
    assert parse_emails(
        "1:[email protected]:john:pass:John Doe:::1900-00-00:00:M:66:729:67793"
    ) == ["*****@*****.**"]
예제 #3
0
def test_parse_emails_invalid() -> None:
    assert parse_emails("*****@*****.**") == []
예제 #4
0
def test_parse_emails_empty() -> None:
    assert parse_emails("Hello, world!") == []
예제 #5
0
def test_parse_email_sentence_multiple() -> None:
    assert parse_emails(
        "Hello [email protected]! How are you? It's [email protected]!"
    ) == ["*****@*****.**", "*****@*****.**"]
예제 #6
0
def test_parse_email_sentence_single() -> None:
    assert parse_emails("Hello [email protected]! How are you?") == ["*****@*****.**"]
예제 #7
0
def test_parse_emails_multiple() -> None:
    assert parse_emails("[email protected] [email protected]") == [
        "*****@*****.**",
        "*****@*****.**",
    ]
예제 #8
0
def test_parse_emails_single() -> None:
    assert parse_emails("*****@*****.**") == ["*****@*****.**"]