From 515164cb0634459ed9362806a5abff2467755dbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Pacheco?= Date: Thu, 12 Sep 2024 18:24:50 -0400 Subject: [PATCH 1/2] fix test_utils.py not to xfail --- tests/test_utils.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/test_utils.py b/tests/test_utils.py index d8d0d6c4..cb1ec05d 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,3 +1,4 @@ +from contextlib import nullcontext import pytest from jwt.utils import force_bytes, from_base64url_uint, is_ssh_key, to_base64url_uint @@ -6,17 +7,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( From ee73f3aa21d0ac6b497db5fddf918c47cb31903e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 12 Sep 2024 22:25:47 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/test_utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_utils.py b/tests/test_utils.py index cb1ec05d..8f199cee 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,4 +1,5 @@ from contextlib import nullcontext + import pytest from jwt.utils import force_bytes, from_base64url_uint, is_ssh_key, to_base64url_uint