Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] authored and lysnikolaou committed Feb 17, 2025
1 parent 505d3ef commit 44ee894
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 30 deletions.
41 changes: 11 additions & 30 deletions tests/test_quoting_benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

try:
from pytest_codspeed import BenchmarkFixture

CODSPEED_MISSING = False
except ImportError:
CODSPEED_MISSING = True
Expand All @@ -21,99 +22,79 @@
LONG_QUERY_WITH_PCT = LONG_QUERY + "&d=%25%2F%3F%3A%40%26%3B%3D%2B"


@pytest.mark.skipif(
CODSPEED_MISSING, reason="pytest-codspeed needs to be installed"
)
@pytest.mark.skipif(CODSPEED_MISSING, reason="pytest-codspeed needs to be installed")
def test_quote_query_string(benchmark: BenchmarkFixture) -> None:
@benchmark
def _run() -> None:
for _ in range(100):
QUERY_QUOTER("a=1&b=2&c=3&d=4&e=5&f=6&g=7&h=8&i=9&j=0")


@pytest.mark.skipif(
CODSPEED_MISSING, reason="pytest-codspeed needs to be installed"
)
@pytest.mark.skipif(CODSPEED_MISSING, reason="pytest-codspeed needs to be installed")
def test_quoter_ascii(benchmark: BenchmarkFixture) -> None:
@benchmark
def _run() -> None:
for _ in range(100):
QUOTER_SLASH_SAFE("/path/to")


@pytest.mark.skipif(
CODSPEED_MISSING, reason="pytest-codspeed needs to be installed"
)
@pytest.mark.skipif(CODSPEED_MISSING, reason="pytest-codspeed needs to be installed")
def test_quote_long_path(benchmark: BenchmarkFixture) -> None:
@benchmark
def _run() -> None:
for _ in range(100):
PATH_QUOTER(LONG_PATH)


@pytest.mark.skipif(
CODSPEED_MISSING, reason="pytest-codspeed needs to be installed"
)
@pytest.mark.skipif(CODSPEED_MISSING, reason="pytest-codspeed needs to be installed")
def test_quoter_pct(benchmark: BenchmarkFixture) -> None:
@benchmark
def _run() -> None:
for _ in range(100):
QUOTER("abc%0a")


@pytest.mark.skipif(
CODSPEED_MISSING, reason="pytest-codspeed needs to be installed"
)
@pytest.mark.skipif(CODSPEED_MISSING, reason="pytest-codspeed needs to be installed")
def test_long_query(benchmark: BenchmarkFixture) -> None:
@benchmark
def _run() -> None:
for _ in range(100):
QUERY_QUOTER(LONG_QUERY)


@pytest.mark.skipif(
CODSPEED_MISSING, reason="pytest-codspeed needs to be installed"
)
@pytest.mark.skipif(CODSPEED_MISSING, reason="pytest-codspeed needs to be installed")
def test_long_query_with_pct(benchmark: BenchmarkFixture) -> None:
@benchmark
def _run() -> None:
for _ in range(100):
QUERY_QUOTER(LONG_QUERY_WITH_PCT)


@pytest.mark.skipif(
CODSPEED_MISSING, reason="pytest-codspeed needs to be installed"
)
@pytest.mark.skipif(CODSPEED_MISSING, reason="pytest-codspeed needs to be installed")
def test_quoter_quote_utf8(benchmark: BenchmarkFixture) -> None:
@benchmark
def _run() -> None:
for _ in range(100):
PATH_QUOTER("/шлях/файл")


@pytest.mark.skipif(
CODSPEED_MISSING, reason="pytest-codspeed needs to be installed"
)
@pytest.mark.skipif(CODSPEED_MISSING, reason="pytest-codspeed needs to be installed")
def test_unquoter_short(benchmark: BenchmarkFixture) -> None:
@benchmark
def _run() -> None:
for _ in range(100):
UNQUOTER("/path/to")


@pytest.mark.skipif(
CODSPEED_MISSING, reason="pytest-codspeed needs to be installed"
)
@pytest.mark.skipif(CODSPEED_MISSING, reason="pytest-codspeed needs to be installed")
def test_unquoter_long_ascii(benchmark: BenchmarkFixture) -> None:
@benchmark
def _run() -> None:
for _ in range(100):
UNQUOTER(LONG_QUERY)


@pytest.mark.skipif(
CODSPEED_MISSING, reason="pytest-codspeed needs to be installed"
)
@pytest.mark.skipif(CODSPEED_MISSING, reason="pytest-codspeed needs to be installed")
def test_unquoter_long_pct(benchmark: BenchmarkFixture) -> None:
@benchmark
def _run() -> None:
Expand Down
1 change: 1 addition & 0 deletions tests/test_url_benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

try:
from pytest_codspeed import BenchmarkFixture

CODSPEED_MISSING = False
except ImportError:
CODSPEED_MISSING = True
Expand Down

0 comments on commit 44ee894

Please sign in to comment.