From affe81c3980e6da04d8d76b35940edb492864f89 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 15 Oct 2024 00:03:57 -0500 Subject: [PATCH] Add benchmarks for empty username and password (#1269) --- tests/test_url_benchmarks.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/test_url_benchmarks.py b/tests/test_url_benchmarks.py index 20500b99a..34a9d52c9 100644 --- a/tests/test_url_benchmarks.py +++ b/tests/test_url_benchmarks.py @@ -145,6 +145,20 @@ def _run() -> None: url.raw_password +def test_url_make_empty_username(benchmark: BenchmarkFixture) -> None: + @benchmark + def _run() -> None: + for _ in range(100): + URL("http://:password@www.domain.tld") + + +def test_url_make_empty_password(benchmark: BenchmarkFixture) -> None: + @benchmark + def _run() -> None: + for _ in range(100): + URL("http://user:@www.domain.tld") + + def test_url_make_with_ipv4_address_path_and_port(benchmark: BenchmarkFixture) -> None: @benchmark def _run() -> None: