MCPcopy Index your code
hub / github.com/JoshData/python-email-validator / test_domain_literal

Function test_domain_literal

tests/test_syntax.py:356–370  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

354
355
356def test_domain_literal() -> None:
357 # Check parsing IPv4 addresses.
358 validated = validate_email("me@[127.0.0.1]", allow_domain_literal=True)
359 assert validated.domain == "[127.0.0.1]"
360 assert repr(validated.domain_address) == "IPv4Address('127.0.0.1')"
361
362 # Check parsing IPv6 addresses.
363 validated = validate_email("me@[IPv6:::1]", allow_domain_literal=True)
364 assert validated.domain == "[IPv6:::1]"
365 assert repr(validated.domain_address) == "IPv6Address('::1')"
366
367 # Check that IPv6 addresses are normalized.
368 validated = validate_email("me@[IPv6:0000:0000:0000:0000:0000:0000:0000:0001]", allow_domain_literal=True)
369 assert validated.domain == "[IPv6:::1]"
370 assert repr(validated.domain_address) == "IPv6Address('::1')"
371
372
373@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 1

validate_emailFunction · 0.90

Tested by

no test coverage detected