()
| 354 | |
| 355 | |
| 356 | def 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( |
nothing calls this directly
no test coverage detected