diff --git a/tests/test_domain.py b/tests/test_domain.py index 9e655041..c26b2bbf 100644 --- a/tests/test_domain.py +++ b/tests/test_domain.py @@ -173,20 +173,20 @@ def test_returns_failed_validation_on_domain_beyond_rfc_limits(value: str): "value", [ # IDNA 2003 maps these to "example.com"; see `_relies_on_idna_mapping` - "example.com", # fullwidth letters - "example.com", - "example.ⅽom", # small roman numeral one hundred - "Kelvin.com", # Kelvin sign - "ſhop.com", # long s + "example.\uff43\uff4f\uff4d", # fullwidth letters + "\uff45\uff58\uff41\uff4d\uff50\uff4c\uff45.com", + "example.\u217dom", # small roman numeral one hundred + "\u212aelvin.com", # Kelvin sign + "\u017fhop.com", # long s "example。com", # ideographic full stop - "example.com", # fullwidth full stop - "example。com", # halfwidth ideographic full stop - "exam­ple.com", # soft hyphen - "example.co​m", # zero width space - "exa‍mple.com", # zero width joiner - "exam️ple.com", # variation selector - "examp⁠le.com", # word joiner - "example.com", # zero width no-break space + "example\uff0ecom", # fullwidth full stop + "example\uff61com", # halfwidth ideographic full stop + "exam\u00adple.com", # soft hyphen + "example.co\u200bm", # zero width space + "exa\u200dmple.com", # zero width joiner + "exam\ufe0fple.com", # variation selector + "examp\u2060le.com", # word joiner + "\ufeffexample.com", # zero width no-break space "exämple.com".replace("ä", "ä"), # not NFC ], ) diff --git a/tests/test_email.py b/tests/test_email.py index f3066c88..9b82eb46 100644 --- a/tests/test_email.py +++ b/tests/test_email.py @@ -68,7 +68,7 @@ def test_rejects_newline_after_local_part(local_part: str): assert isinstance(email(f"{local_part}\n@example.com"), ValidationError) -@pytest.mark.parametrize("domain_part", ["example.com", "exam­ple.com"]) +@pytest.mark.parametrize("domain_part", ["example.\uff43\uff4f\uff4d", "exam\u00adple.com"]) def test_returns_failed_validation_on_idna_mapped_lookalike_domain(domain_part: str): """Test returns failed validation on email domains that only IDNA 2003 mapping makes valid.""" assert isinstance(email(f"user@{domain_part}"), ValidationError) diff --git a/tests/test_hostname.py b/tests/test_hostname.py index 97671267..5855649c 100644 --- a/tests/test_hostname.py +++ b/tests/test_hostname.py @@ -127,13 +127,15 @@ def test_rejects_trailing_newline_in_hostnames_and_ports(value: str): assert isinstance(hostname(value), ValidationError) -@pytest.mark.parametrize("value", ["ſerver", "Kelvin", "ıntranet", "İntranet:8080"]) +@pytest.mark.parametrize( + "value", ["\u017ferver", "\u212aelvin", "\u0131ntranet", "\u0130ntranet:8080"] +) def test_returns_failed_validation_on_non_ascii_simple_hostname(value: str): """Test returns failed validation on non-ASCII case equivalents in simple hostnames.""" assert isinstance(hostname(value), ValidationError) -@pytest.mark.parametrize("value", ["example.com", "exam­ple.com:443"]) +@pytest.mark.parametrize("value", ["example.\uff43\uff4f\uff4d", "exam\u00adple.com:443"]) def test_returns_failed_validation_on_idna_mapped_lookalike_hostname(value: str): """Test returns failed validation on hostnames that only IDNA 2003 mapping makes valid.""" assert isinstance(hostname(value), ValidationError) diff --git a/tests/test_url.py b/tests/test_url.py index 2cfded8b..af22edb3 100644 --- a/tests/test_url.py +++ b/tests/test_url.py @@ -261,7 +261,7 @@ def test_url_accepts_percent_encoded_controls(encoded: str, template: str): @pytest.mark.parametrize( "value", - ["https://example.com/", "https://exam­ple.com/", "http://ſerver/"], + ["https://example.\uff43\uff4f\uff4d/", "https://exam\u00adple.com/", "http://\u017ferver/"], ) def test_returns_failed_validation_on_idna_mapped_lookalike_url(value: str): """Test returns failed validation on url hosts that only IDNA 2003 mapping makes valid."""