Skip to content

Commit

Permalink
fix test_utils.py not to xfail (#987)
Browse files Browse the repository at this point in the history
* fix test_utils.py not to xfail

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pachewise and pre-commit-ci[bot] authored Sep 28, 2024
1 parent 6c7cc61 commit a63d75c
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from contextlib import nullcontext

import pytest

from jwt.utils import force_bytes, from_base64url_uint, is_ssh_key, to_base64url_uint
Expand All @@ -6,17 +8,18 @@
@pytest.mark.parametrize(
"inputval,expected",
[
(0, b"AA"),
(1, b"AQ"),
(255, b"_w"),
(65537, b"AQAB"),
(123456789, b"B1vNFQ"),
pytest.param(-1, "", marks=pytest.mark.xfail(raises=ValueError)),
(0, nullcontext(b"AA")),
(1, nullcontext(b"AQ")),
(255, nullcontext(b"_w")),
(65537, nullcontext(b"AQAB")),
(123456789, nullcontext(b"B1vNFQ")),
(-1, pytest.raises(ValueError)),
],
)
def test_to_base64url_uint(inputval, expected):
actual = to_base64url_uint(inputval)
assert actual == expected
with expected as e:
actual = to_base64url_uint(inputval)
assert actual == e


@pytest.mark.parametrize(
Expand Down

0 comments on commit a63d75c

Please sign in to comment.