Skip to content

Commit a63d75c

Browse files
fix test_utils.py not to xfail (#987)
* 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>
1 parent 6c7cc61 commit a63d75c

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

tests/test_utils.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from contextlib import nullcontext
2+
13
import pytest
24

35
from jwt.utils import force_bytes, from_base64url_uint, is_ssh_key, to_base64url_uint
@@ -6,17 +8,18 @@
68
@pytest.mark.parametrize(
79
"inputval,expected",
810
[
9-
(0, b"AA"),
10-
(1, b"AQ"),
11-
(255, b"_w"),
12-
(65537, b"AQAB"),
13-
(123456789, b"B1vNFQ"),
14-
pytest.param(-1, "", marks=pytest.mark.xfail(raises=ValueError)),
11+
(0, nullcontext(b"AA")),
12+
(1, nullcontext(b"AQ")),
13+
(255, nullcontext(b"_w")),
14+
(65537, nullcontext(b"AQAB")),
15+
(123456789, nullcontext(b"B1vNFQ")),
16+
(-1, pytest.raises(ValueError)),
1517
],
1618
)
1719
def test_to_base64url_uint(inputval, expected):
18-
actual = to_base64url_uint(inputval)
19-
assert actual == expected
20+
with expected as e:
21+
actual = to_base64url_uint(inputval)
22+
assert actual == e
2023

2124

2225
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)